Discussions
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