Discussions
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)