This topic contains 3 replies, has 0 voices, and was last updated by Olivier Gagnon NC 6 years, 10 months ago.
-
AuthorPosts
-
January 10, 2018 at 3:20 pm #18188
darrenhillconsultingPlease tell me this has been done … and I’ve not run into a SS2 Bug. Its very simple, I’m fully receiving a PO and need to add the Lot Number to the line.
Code:
var itemReceipt = record.transform({fromType: ‘purchaseorder’, fromId: 1, toType: record.Type.ITEM_RECEIPT, isDynamic: true});itemReceipt.selectLine({ sublistId: ‘item’, line: 0 });
itemReceipt.setCurrentSublistValue({ sublistId: ‘item’, fieldId: ‘itemreceive’, value: true });
itemReceipt.setCurrentSublistValue({ sublistId: ‘item’, fieldId: ‘quantity’, value: ‘5’ });var inventoryDetail = itemReceipt.getCurrentSublistSubrecord({ sublistId: ‘item’, fieldId: ‘inventorydetail’ });
inventoryDetail.selectNewLine({ sublistId: ‘inventoryassignment’ });
inventoryDetail.setCurrentSublistValue({ sublistId: ‘inventoryassignment’, fieldId: ‘receiptinventorynumber’, value: ‘FAKE_LOT’ });
inventoryDetail.setCurrentSublistValue({ sublistId: ‘inventoryassignment’, fieldId: ‘quantity’, value: ‘5’ });
inventoryDetail.commitLine({ sublistId: ‘inventoryassignment’ });itemReceipt.commitLine({ sublistId: ‘item’ });
itemReceipt.save();
I’m getting … “type”:”error.SuiteScriptError”,”name”:”PLEASE_CON FIGURE_THE_INVENTORY_DETAIL_FOR_1″,”message”:”Plea se configure the inventory detail for KMB008.”
This is a cached copy. Click here to see the original post. -
January 11, 2018 at 12:33 pm #18189
Olivier Gagnon NCI suspect it might be the selectNewLine. I checked some code I have that does exactly this, and it matches all your list names and field names and stuff. So I think it might be the newLine and commit. My code doesn’t have that stuff and it works.
-
January 12, 2018 at 11:58 am #18190
darrenhillconsultingYes Olivier, I converted the script to NOT use dynamic mode … and I’m good. Thanks!
However, doing the same on an ItemFulfillment is 100% broken … had to resort to building an SS1.0 script for ItemFulfillments with Inventory Details. Not fun.
-
January 15, 2018 at 9:26 am #18191
Olivier Gagnon NCIf I remember correctly, everything works but the huge problem is you must specify Serial Numbers by referring to their Internal ID, which makes it an incredible hassle.
-
AuthorPosts
You must be logged in to reply to this topic.