Is there some sort of trick in how to set custom a...
# suitescript
j
Is there some sort of trick in how to set custom addresses in script on a sales order? I'm doing getSubrecord but the address isn't getting saved on the order. The billing address in the UI after save is showing custom, but the address shown is the default billing on the customer record. The shipping address which matches the record on the customer record is pulling the shipping address from the customer instead of showing as "CUSTOM" any help would be appreciated
s
IIRC the SO only keeps a copy of the address.
j
I don't understand what's happening to the address just doing var billingAdr = soRec.getSubrecord({ fieldId: 'billingaddress' }); and then later just calling save on the sales order. I've also tried setting the billcity on the sales order record with no luck
b
in general there are 2 tricks to setting address on the sales order
one is setting the address list to custom
and the other is to set the address
j
So are you saying setValue({fieldId:'billadresslist',value:-2})... then doing setValue({fieldId:'billcity'}) on the sales order and not the sub record?
b
i've had more luck with using setText with '- Custom -'
but yes
you can still use the subrecord to set the address fields
and it is netsuite's preferred way of setting addresses
it also sounds like your account is on 2018.2
you may wish to review the "2019.1 Address Scripting Changes to Support Transaction Tax Calculations" help topic
j
Thanks @battk I couldn't use setText but setValue (-2 for Custom) worked and getSubrecord followed by setting field values on that record worked