I am updating the shipping address on the invoice, this works and it updates the shipping address properly. The issue is that for existing lines it does not recalculate the tax codes (e.g. when changing from a domestic address to a foreign address). This happens only in UI when I open the shipping address window and save it (this will trigger an update of all tax codes on all lines).
If I do it via SuiteScript it only works for new lines. Is there a way to trigger a recalculate of tax codes similarly as it is in UI? I tried to select and commit the line but that does not work neither in UI or SS.
Thanks.
This is the code I am using on a UE script:
function userEventAfterSubmit(type){
// load sales order record
var invoice = nlapiLoadRecord('invoice', nlapiGetRecordId(), false);
nlapiLogExecution('DEBUG', 'id='+invoice);
// set shippingadresslist to null in order to make it update to -Custom-
invoice.setFieldValue('shipaddresslist', null);
// set shipping details
invoice.setFieldValue('shipcountry', 'US');
invoice.setFieldValue('shipisresidential', 'F');
invoice.setFieldValue('shipaddressee', 'NetSuite Inc.');
invoice.setFieldValue('shipaddr1', '2955 Campus Drive');
invoice.setFieldValue('shipaddr2', 'Suite - 100');
invoice.setFieldValue('shipcity', 'San Mateo');
invoice.setFieldValue('shipstate', 'CA');
invoice.setFieldValue('shipzip', '94403');
nlapiSubmitRecord(invoice);
}