Does anyone have advice on creating address subrec...
# suitescript
r
Does anyone have advice on creating address subrecords for various countries? I found country codes, and those work, but for countries other than the U.S. the zip code lookup doesn't work properly, and I can't exactly add state codes for every country. It's not accepting the text version for states, it appears to require a state code. It looks like zip codes override for the US, but it doesn't work anywhere else.
It looks like even with Canadian state codes and country code, the failure of the zip code is wiping out address one, state and zip. I have to do some more testing but only Addressee and Country are coming through under this scenario. @Sam-I-Am
n
which countries do you need states for? US / Canada?
r
could be any really. i have a json object for US, CA, and MX for state codes and country codes. it still doesn't work for canada because of the zip code issue.
makes sense, zip code autofills city and state for the U.S.
n
Where are you seeing this not working as expected? Are you on an address record and entering the Zip Code and expecting other details to populate?
s
How are you creating the address subrecords? Be aware that, whether created through the UI or in code, the country should always be set first. Once the country has changed, the restrictions on the state/province and postal code fields should change, accordingly.
šŸ‘ 1
r
Scripting, however if you create an address record in the UI, zip code autopopulates state. It doesn't appear to work for Canada. Ex. Toronto, Ontario, M5G 2C8
r
@scottvonduhn I think that's it. I was populating country last.
s
I’d recommend setting fields in this order. After some experimentation, this has worked well for us: country, zip code, state, city, address 1, address 2, etc.
r
SOLVED
šŸŽ‰ 1
Country apparently defaults to US, resetting was wiping out the other fields.
s
yeah, the country and zip code fields both either reset, or update other fields, so they should definitely be set before any others