Sunday, September 9, 2018

Shipping Method is removed when Shipping Address is modified by server-side script

Overview:

  • Sample code to change the shipping address in a Sales Order.

var soRec = nlapiLoadRecord('salesorder', ####);
soRec.setFieldValue('shipaddresslist', ######);
nlapiSubmitRecord(soRec, true);

  • Check the Sales Order again in UI and the shipping method field is empty.
  • Also checked with the script debugger and the Ship Via field (shipmethod) becomes 'null'

 

Solution: Add an extra line to set the shipping method again before re-submit the SO.

 soRec.setFieldValue('shipmethod', soRec.getFieldValue('shipmethod'));

 

Note: In the UI, if the shipping address is changed, only the shipping cost will become To be Calculated but the Ship Via (shipping method) field is remain unchange.

No comments:

Post a Comment