Im using the REST Api to transform a sales order i...
# suitescript
t
Im using the REST Api to transform a sales order into an item fulfillment and was wondering if there's a way to get information first before creating it. When creating the item fulfillment, netsuite automatically populates the inventory detail for some lines. When it does populate, i don't need to include anything in the json for inventory detail/inventory assignment because the quantity already matches. When it does not populate (due to some items not having default values), I need to include a json object in the request for the inventory detail. Is there a way to get information about what the created item fulfillment looks like before it gets saved? I need to figure out which lines I need to include an inventory detail for. Or would there possibly be a way to overwrite what the inventory detail is so I can always include it in the json body? I can't currently always include it because the pre-populated lines exist and give an error saying the quantity must match X.
c
You can use record.transform() in a dry-run approach. Transform the SO to fulfillment without saving, then check which lines have inventory detail populated. Loop through the lines and see if
getSublistValue('item', 'inventorydetail')
returns null. Alternatively, just always include inventory detail in your JSON but match the existing assignments exactly when they're pre-populated. The quantity matching error happens when you're overriding instead of matching.
t
I'm using the rest API simple smile
This is for automation, the user isn't going to use code or go through the UI to see manually if which inventory detail values are empty. I tried always including the inventory detail but because of the pre-populated lines, the quantity will never match what is expected. what do you mean "match the existing assignments"?
y
This is NetSuite limitations. You won't get any information before creating IF by NetSuite Rest API. Workaround solution #1- A. you may create your own api using restlet script and return all the required information using record.transform api. B. Before calling NetSuite Rest API get all the required information using your own custom API Workaround Around #2 - A. You can create own custom API using restlet script to create IF. For more information please DM me. Thanks
👍 1