Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
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)