我一直在尝试使用suitescript2.0在NetSuite的现有估算值上设置帐单和送货地址。我当前的代码
function createSalesOrderAddress(data){
var estimate = data.record;
log.debug("Address Parts", JSON.stringify(data));
// set billing details
estimate.setValue('billaddresslist',-2);
var addr = estimate.getSubrecord('billingaddress');
addr.setValue('country', 'AU');
addr.setValue('isresidential', 'F');
addr.setValue('attention', '');
addr.setValue('addressee', data.address.firstname + " " + data.address.surname);
addr.setValue('addr1', data.address.address1);
addr.setValue('city', data.address.suburb);
addr.setValue('state', data.address.state);
addr.setValue('zip', data.address.postcode);
estimate.setValue('billaddress', data.address.address1 + 'n' + data.address.suburb + ' ' + data.address.state + ' ' + data.address.postcode + 'nAustralia');
//set shipping details
estimate.setValue('shipaddresslist',-2);
var shipaddr = estimate.getSubrecord('shippingaddress');
shipaddr.setValue('country', 'AU');
shipaddr.setValue('isresidential', 'F');
shipaddr.setValue('attention', '');
shipaddr.setValue('addressee', data.address.firstname + " " + data.address.surname);
shipaddr.setValue('addr1', data.address.address1);
shipaddr.setValue('city', data.address.suburb);
shipaddr.setValue('state', data.address.state);
shipaddr.setValue('zip', data.address.postcode);
estimate.setValue('shipaddress', data.address.address1 + 'n' + data.address.suburb + ' ' + data.address.state + ' ' + data.address.postcode + 'nAustralia');
return estimate;
}
当我注释掉设置送货地址的部分时,该代码可以很好地工作,但是对于送货部分,它将无法工作。设置收货地址的方式与设置帐单地址的方式是否有所不同?
我收到无用的错误 “ type”:“ error.SuiteScriptError”,“ name”:“ UNEXPECTED_ERROR”,“ message”:null