Currently there is no server side API or a mechanism to explicitly force the shipping cost recalculation when submitting or updating a sales order programmatically thus being the functional equivalent to clicking the "Calculate Shipping" button in UI.
If you want Netsuite to automatically calculate the shipping cost you need to make sure that you change / update the quantity or any aspect of the order that impacts the shipping cost.
If you do not want Netsuite to calculate the shipping automatically you need to submit the shipping cost to prevent Netsuite from running the calculation again.
1. When you change the quantity on the order, this triggers the recalculation. If you have a particular shipping item set to zero as the default, the sales order shipping cost will be reset to zero as well, otherwise it will use the appropriate value from the shipping item:
var record = nlapiLoadRecord('salesorder',771);
record.setLineItemValue('item','quantity', 1, 1);
var id = nlapiSubmitRecord(record, true);
The following approach explicitly sets the shipping method and the shipping cost thus functionally preventing the recalculation.
var record = nlapiLoadRecord('salesorder', 771)
record.setFieldValue('shipmethod',2);
record.setFieldValue('shippingcost',12.0);
id = nlapiSubmitRecord(record, true, true);
No comments:
Post a Comment