I can set shipping address just fine on the sales ...
# suitescript
n
I can set shipping address just fine on the sales order. But billing address is not setting. Any ideas why? Same fields, same function just different objects passed.
b
what does the code look like
n
Copy code
const addAddress = (addrRec, addrObj) => {
    addrRec.setValue({fieldId: 'country', value: addrObj.country});
    addrRec.setValue({fieldId: 'addressee', value: addrObj.addressee});
    addrRec.setValue({fieldId: 'attention', value: addrObj.attention});
    addrRec.setValue({fieldId: 'addr1', value: addrObj.addr1});
    addrRec.setValue({fieldId: 'addr2', value: addrObj.addr2});
    addrRec.setValue({fieldId: 'city', value: addrObj.city});
    addrRec.setValue({fieldId: 'state', value: addrObj.state});
    addrRec.setValue({fieldId: 'zip', value: addrObj.zip});
};
if (orderData.billing_address) {
    log.audit('billing_address')
    let billAddr = orderData.billing_address;
    salesOrder.setValue({fieldId: 'billaddresslist', value: '-2'});
    let billingAddrRec = salesOrder.getSubrecord({fieldId: 'billingaddress'});
    addAddress(billingAddrRec, {
       addressee: billAddr.first_name + ' ' + billAddr.last_name,
       attention: billAddr.company,
       addr1: billAddr.address1,
       addr2: billAddr.address2 || '',
       city: billAddr.city,
       state: billAddr.province,
       zip: billAddr.zip,
       country: billAddr.country_code
    });
}
@battk
b
don't set the
billaddresslist
, netsuite will set it automatically in most cases
if it isn't you are going to need to share more context like script type, entry point, dynamic mode and so on. Enough to reproduce the problem