Is there a way to access the countries and states ...
# suitescript
v
Is there a way to access the countries and states list via SuiteScript 2.0?
b
Copy code
var customerRecord = record.create({ type: record.Type.CUSTOMER, isDynamic: true });
var addressRecord = customerRecord.getCurrentSublistSubrecord({ sublistId: 'addressbook', fieldId: 'addressbookaddress' });
var countryField = addressRecord.getField({ fieldId: 'country' });
var countryList = countryField.getSelectOptions();
addressRecord.setValue({ fieldId: 'country', value: 'US' });
var stateField = addressRecord.getField({ fieldId: 'dropdownstate' });
var stateList = stateField.getSelectOptions();
Change "US" to whatever country you want to get states from
b
you may also want to consider doing a state search to get the short names of your states
m
You can use suiteql to get countries