<@U2S643ARW> You get the subrecord and hold it in ...
# suitescript
n
@rmlakhani You get the subrecord and hold it in the subRec object. You then get, what I can only assume is line 0. I think you will find that line 0 will exist just not populated until you populate the rest of the fields manually and submit on those contact records that do not have an addressbook record. However I also suspect you have the country set to default to the US. Instead of looking at subRec.getValue({ fieldId : 'country' }); Have you tried looking at: contactRec.getSublistValue({ sublistId: 'addressbook', fieldId: 'country', line: i }); ?
r
Ill give it a shot, I really hope it doesn’t come back with “US” lol
DAMN! it came back with “US”
n
Do you have values in other fields on that line?
r
just default billing and shipping check boxes
n
Ok but if there are no other values can you use that fact to drive what you're trying to do?
So for instance should you always have a zip?
r
not always, in some instances yes
also depends on how the data is coming into NS and those fields are being set correctly
n
OK just wondering if you can switch focus from what you're looking to use that doesn't seem fit for purpose to another option.
r
yeah i hear ya, but the country is a catch all use case
if it doesn’t have a country, perform certain logic else perform other logic
its not like I cant make a condition where it would check for country = ‘US’
n
I was meaning there's no point checking the country if half the other fields are missing potentially. So before you do === "US" you check that it's worth going in to the code that depends on "US"