If I had to access each line item as a record from...
# suitescript
b
If I had to access each line item as a record from the
items
sublist of a record (let’s say Item Receipt), how would I approach that?
s
Using
N/record
,
record.getSublistValue()
, might wanna use
record.getLineCount()
for building the loop
👍 1
b
I was thinking more like getting whole line as an object and I can access field values from it. I guess there is no way to do that. But your answer helps. I can make it work using that. Thank you very much.
b
the somewhat undocumented way is to load the record using N/record and use .toJSON on it
you get a javascript object that is a representation of the record
b
how would you do that for a subrecord? you can’t load a subrecord like you load a record using N/record module
b
items are not a subrecord, they are a sublist, they are part of a record
🎉 1
and you would find their data on the recrod
b
Well that worked.. Thanks a lot for that.. that saves a bunch of time for me.