Sunday, December 23, 2018

Get value of Sales Order's Source field when the order comes from the Webstore

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();

   var rec = nlapiLoadRecord('salesorder',recId)
   var sourcesite = rec.getFieldValue('source');

No comments:

Post a Comment