Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
Can't get State and Country from Sales Order
How do I get address info from the customer record?
This is what I am trying right now.
var customerID = nlapiGetFieldValue( 'entity' );
alert('Customer internal ID '+customerID)
var filters = new Array();
filters[0] = new nlobjSearchFilter('internalid', null, 'anyof', 'customerID' , null );
var customerRecord = nlapiSearchRecord('customer', null, filters, null );
alert('Customer record is '+customerRecord)
for ( var i = 1; i <= customerRecord.nlapiGetLineItemCount('addressbook' ); i++ );
{
var isDefaultShipping = customerRecord.nlapiGetLineItemValue( 'addressbook', 'defaultshipping', i )
if ( isDefaultShipping == 'T')
{
var shipCountry = customerRecord.nlapiGetLineItemValue( 'addressbook', 'country', i )
var shipState = customerRecord.nlapiGetLineItemValue( 'addressbook', 'state', i )
}
}
alert('Customer country is '+country)
alert('Customer country is '+state)