Has anyone used the script from SuiteAnswer 37999 ...
# suitescript
j
Has anyone used the script from SuiteAnswer 37999 "Populate Inventory Details from Item Fulfillment to Sales Order via Scripting"?? Using the SuiteScript 1.0 version on the SuiteAnswer page, the script runs once perfectly. However after that the script errors on the
nlapiSubmitRecord
with an error "`Invalid issueinventorynumber reference key 8007.; ID:` in which 8007 is the Internal ID of the items first serial number. Crazy how it works fine once but never a second.
b
you would get the same problem in the ui if you tried removing the inventory detail and tried adding back the same serial number on the new inventory detail
the logic for generating the list of valid serial numbers still thinks that the serial number is assigned in the inventory detail that you removed
the cleanest way to fix the problem is to modify the existing inventory detail instead of removing it
the lazy way is to save the record twice, once to remove all the inventory details, and again to add the inventory details
the lazy way will cost twice the amount of time since you are doubling the number of saves
either way, you would want to change when the script runs, its absurd to do it in the beforeLoad, especially without any sort of check to avoid unnecessary changes
j
Thank you for this. I do appreciate it