Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
How does afterSubmit works?
I created a script that must be executed then the Item Fulfillment form is Submitted (Save)
In the Custom Code of the form I selected the script and in the Save Record Function I typed afterSubmit
In my script the afterSubmit function looks like this:
function afterSubmit(type) {
var rshipID = nlapiGetFieldValue('shipmethod');
var sonum = nlapiGetFieldValue('createdfrom');
if (rshipID == 12600) {
rship = 'WILSON TRUCKING (540) 949-3200 (www.wilsontrucking.com)';
}
if (rshipID == 12601) {
rship = 'R+L CARRIERS (800) 543-5589 (www.rlcarriers.com)';
}
var record = nlapiLoadRecord('salesorder', sonum); // load the sales order
record.setFieldValue('custbodyrealshipvia', rship); // set the field display value for Location to East Coast