The source field indicates where the Sales Order originated. If the order is created via Webstore and multiple Web Site is enabled, it does not return a value via nlapiGetFieldValue, triggered on either Before Load or After Submit.
As a solution, on After Submit, re-load the record via nlapiLoadRecord, then get the source field's value via getFieldValue().
Below is a sample code:
function afterSubmit(){
var recId = nlapiGetRecordId();
nlapiLogExecution('DEBUG','id',recId);
var rec = nlapiLoadRecord('salesorder',recId)
var sourcesite = rec.getFieldValue('source');
nlapiLogExecution('DEBUG','source',sourcesite);
}
No comments:
Post a Comment