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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
afterSubmit and the Web Store
I am trying to get an afterSubmit to run on orders placed for a specific customer from our web store. The script works great on any sales order taken by phone and entered by our sales reps into Netsuite, but any time the customer orders online, the script does not do what it's intended to. It's a basic thing, I just need a custom field populated with Blind Ship instructions for this specific customer. Here's the script:
function afterSubmit(type) { var recSO = nlapiGetNewRecord(); var intID = recSO.getId(); if (type == 'create') { var recSalesOrder = nlapiLoadRecord('salesorder', intID); var stCustomer = recSalesOrder.getFieldText('entity'); nlapiLogExecution('DEBUG', 'CustID', stCustomer); if (stCustomer == 'customer name'){ recSalesOrder.setFieldValue('custbody1', 'BLIND SHIP. Do not include packing slip or invoice.') } var intOrderID = nlapiSubmitRecord(recSalesOrder, true); nlapiLogExecution('DEBUG', 'Order ID', intOrderID); } } 0