Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
How do I make sure I'm grabbing the correct record ID when using a User Event Script?
I'm creating a script that sends an email after an item fulfillment has been marked as shipped.
Here is a small sample of my script. It's all ready to go except I'm not sure how to dynamically grab the record ID of the item fulfillment that was just marked shipped. Is there a way to use scriptContext to store the item fulfillment id as the parameter to the afterSubmit function?
define(['N/email', 'N/record'],function(email, record) { function afterSubmit(scriptContext) { var fromId = 450103; // my internal ID var itemFulfillmentId = ''; //THIS IS THE RECORD ID I NEED TO GRAB //loads item fulfillment var itemFulfillment = record.load({ type: record.Type.ITEM_FULFILLMENT, id: itemFulfillmentId, isDynamic: true }); 0