I am trying to validate address off a custom recor...
# general
m
I am trying to validate address off a custom record we refer to as "Asset". It is a record that basically stores information about a customer's residence. However my attempts to load the proper address is failing to work. When I attempt to iterate through the sublist "addressbook" off the customer it returns the same address for both lines even though there are 2 different addresses. Also all the ID's that are returned don't match those on the UI or those returned when pulling the address from the "Asset" records "Address Select" field. I am at a loss at why why I am getting the same value twice, do I need to go one more layer down from the addressbook?
Here is a screenshot of the debug screen.
b
stop using const
on other news, when did const become valid
j
server side netsuite const does not behave the same way as es6 const
es6 const is scoped to the containing block. server side netsuite const follows the same scoping rules as var, so here it is scoped to the whole function. es6 const throws an error if you try to reassign/redeclare the variable. server side netsuite const silently moves on like the reassignment statement wasn't there
m
so that was my attempt was to use const for items that I would not reassign/redeclare. Still I swapped all to var and have the same results. Internal id of address, but when I try and pull using the "addressid" I get back the id for the addressbook instead of the address internal id.
Do you mean that within the "for" loop that redeclaring meat that wouldn't work? Changing to var doesn't help and it still loads the same address multiple times.
What I am trying to do is search for the referenced internal id of the address that I want to validate that I get off the "Asset" record.
OK I was able to fix...thanks for your help.
You were right and it was using const in the "for" loop. Switching to var didn't work when I first tested because I copied a static line value.
this is how I ended up being able to get the right ID -> customerRecord.getSublistValue({ sublistId: 'addressbook', fieldId: 'internalid', line: i })
I assume that the ID that is being returned on the UI and the one being returned from the "Asset" record was in fact the "addressbook" internalid & not the address internalid.