Does anyone know how to access the `options` on an...
# suitescript
s
Does anyone know how to access the
options
on an item on a Purchase Order? I've tried
po.getCurrentSublistValue({ sublistId: 'item', fieldId: 'options' });
and
po.getCurrentSublistText({ sublistId: 'item', fieldId: 'options' });
and
po.getCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'options' });
to no avail
b
that looks correct
s
which one? none of them are working
b
Copy code
po.getCurrentSublistValue({ sublistId: 'item', fieldId: 'options' })
you can try sharing your code
but honestly i would tell you to get the custom column field instead
s
What do you mean by that?
b
item options are custom columns
get the value from the custom column instead
s
Can I get a list of the custom column names off the item?
Because otherwise i dont see how that could work
b
are you writing generic code to get any item options
s
yea
Goal is to run through the items on the Purchase Order and capture any options that exist on the items
b
then its probably less work to get the item options working
what does your current code look like
s
I created a purchase order that contains items with options, but when I use
po.getCurrentSublistValue({ sublistId: 'item', fieldId: 'options' })
, it is giving me nothing at all (like when you spell a fieldId wrong)
idk how much current code would be useful but hm
Copy code
for (var i = 0; i < lineCount; i++) {
        po.selectLine({ sublistId: 'item', line: i });
   var options = po.getCurrentSublistValue({ sublistId: 'item', fieldId: 'options' });
   log.debug({title: 'options value', details: options});
}
Thats a portion of it
Within the for loop theres other statements like the options one that function just fine, like capturing the item description, quantity, rate, units etc
b
are you using N/currentRecord or N/record
s
N/record to load the po
then selecting each item line in that for loop using
po.selectLine({ sublistId: 'item', line: i });
b
turns out its a generated field
you will have to do what i told you to do in the beginning
s
wait what does it mean that it's a generated field?
b
its value is derived from other fields
its not stored on the transaction record
that should take you to the list of custom item options fields in your account
get the values of each of those fields
instead of options
s
oh boy
so I have to figure out how to load this whole list in suitescript
The values in there strangely dont seem to match up to what i see on the item options on the PO though...
even though the field internal ids match
Ok but I'm also still baffled as to why options is listed as a item sublist field in the Records browser, and yet I can't access it?
b
you can try your code client side using N/currentRecord to see the options field