Hi, can someone help me with the inventorydetails ...
# suitescript
c
Hi, can someone help me with the inventorydetails subrecord? i'm testing on a browser console, assume it's client side script using the api 2.0.
require([]);
r = require("N/record");
so = r.load({ type: "salesorder", id: 4});
lineCount = so.getLineCount({sublistId: 'item'});
lineSubrecord = so.getSublistSubrecord({ sublistId: 'item', line: 3, fieldId: "inventorydetail" })
but the lineSubrecord has no data at all i'm aware the CSs can't modify subrecords but i'm just trying to access to the data, which according to the docs it's possible
e
It's possible to read the subrecord if it exists. getSublistSubRecord will attempt to create the subrecord if it doesn't exist
that'll give you a hard time in client scripts
c
i'm getting a record which has the structure but no data
if i do something like
li.getFields().map(f => { return f + " -> '" + li.getValue({fieldId: f}) + "'"})
i get some values but all like "_csrf" none of the good stuff
e
weird - can't help ya there - maybe try the debugger?
c
looks like i have to 😕
b
its 1.0 but there is specific help on that subrecord
basic idea is that the interesting stuff for inventory details is on the inventoryassignment sublist
c
tx, I dunno why I can get the data using 1.0 api but not the 2.0, looks like the might be internal restrictions. I shouldn't use it on a cs for real but I was trying to see how it worked before spending too much time looking for how to test it
d
Did you try dynamic mode? Like: so = r.load({ type: "salesorder", id: 4, isDynamic: true}); so.selectLine({sublistId: 'item', line: 3}); const inventoryDetailsObject = so.getCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'inventorydetail', });