Hi everyone is there any other way to get some sub...
# suitescript
s
Hi everyone is there any other way to get some sublist field value from a record apart from using record.load, save search or query?
b
the exotic answer is N/render
you can render as a string that you can then parse
s
@battk Thanks, But the scenario is like on invoice recd i need to load the item recd and get some value from sublist so I'm not getting how can i use render method here I will be very thankful if you can explain.
b
i think you mean get a value from an item sublist
in which case you use render.transaction and print it as html
which will be a string that you can parse to find your sublist values
s
@battk I mean from inventory sublist of item record.
b
then the answer is to use N/search or N/query to find the data you are looking for
N/record may or may not have it depending on the features in the account
s
@battk Thanks, actually someone asked same question and i have told him these 3 ways load, search and query but he said there is another way and i have searched the almost everywhere but didn't find any and i guess there is no other way. Thanks a lot.
b
N/https is the other option, though again exotic,
it usually doesnt have access to information that the other data sources dont
s
@battk How N/https can be used here
b
s
@battk thank you, i will check this.
w
@battk really exotic route with N/render. What was the use-case for that? Fast?
b
desperation, N/render has access to the apply sublist on customer payments
👍 1
w
Interesting 😃
s
NFT is of course, the best way.
😂 1
w
NFT still needs to load the record using Nersuites API, right?
s
of course, it's just suitescript, but kinder, gentler suitescript 🙂
Copy code
const inv = new Invoice(1234)
const found = _.find(inv.item, line => line.item == someitemid)
...etc.
the only other illegal way I can think of is to JSON.stringify() the record then parse it back.
w
So it violates OPs requirements 😉
s
which I never do, because it's utterly undefined behavior