TMann
TMann

Reputation: 781

Accessing Address fields in Suitescript on Transaction level

In 2014.2 Netsuite changed it's structure of addresses making them subrecords. They have a lot of help around scripting addresses on the Customer level or Form level, however I need to on the transaction (quote, sales order, invoice) level.

Help for transaction level appears to be just this page: https://netsuite.custhelp.com/app/answers/detail/a_id/39551/kw/address

This however is creating a custom address which shows that custom billing and shipping addresses have their own internal id.

What is the internal ID that I can use on the nlapiViewSubrecord(fldName) call to get at the values of say country, state, zip, etc on the billing and/or shipping addresses? I have tried 'billaddress' and 'shipaddress' respectively with no luck.

Upvotes: 0

Views: 3647

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8902

Try billingaddress and shippingaddress. I've recently made a similar update to some of our Sales Order code, and this is what worked for me.

// {String} The type of address to create, will be one of ship or bill
var addressType = (type === 'ship' ? 'shippingaddress' : 'billingaddress');

// {nlobjSubrecord} Address subrecord object
var subrecord = order.createSubrecord(addressType);

(This is in a RESTlet; the type value here is something that gets sent to us)

Upvotes: 2

Related Questions