Ok I have 2 dumb frustrating problems: 1) I am try...
# suitescript
s
Ok I have 2 dumb frustrating problems: 1) I am trying to retrieve the text of a sublist field, as I have done with many other sublist fields successfully, however for this particular select field,
po.getCurrentSublistValue({ sublistId: 'item', fieldId: fieldName });
and
po.getCurrentSublistText({ sublistId: 'item', fieldId: fieldName });
BOTH return the same things, the internal ID of a select record. I need the text of the record ideally. Under what circumstances will getText not work as expected? 2) I am trying to set a checkbox field. Any checkbox field in fact. One example is the
tobeemailed
field. I have tried
newSO.setValue({ fieldId: 'tobeemailed',  value: 'T' });
I have tried
value: true
nothing works. What value do I need to pass into
setValue
to set a checkbox?
b
you might want to say which field you are working with. In general, text and internal id are only the same for some special native fields
for your checkbox,
true
is generally what you want.
'T'
is the fallback if something weird happens
you are giving a bad example with tobeemailed. NetSuite will uncheck that field when it send the email.
s
Thats good to know I didn't realize it was a bad example, but neither boolean or 'T'/'F' values seem to set
And with the field I'm working with, I finally got those item option field names and so its a custcol Item Option field
problem 2 is solved now, just problem 1 😞
s
try
value: 1
s
the boolean thing started working now, to be honest idk what changed lol but now it works w/ boolean true/false
Now if i could just get the sublist text i would be so happy lol
s
ok that's good. I seem to recall some funkiness where ( I think a checkbox?) didn't obey true/false
if you can't get the text value directly, you could always load the related thing and access the field that way, at the expense of more processing time?
no wait, I just noticed you're using the 'current' api
I'd avoid that if I were you, because I think the text values aren't available in that mode
s
I was thinking the same thing, but I have no idea how to in this case haha so like i said, this field is a custom item option field, with the options pulled off the item record itself
but I'm not sure how to get the actual list record associated with the item option
what do you mean the current api?
I'm using N/record not N/currentrecord
s
getCurrentSublistValue
vs
getSublistValue
s
oh you mean like im in dynamic mode
I actually tried getSublistValue too using line: i but I got the same result
s
I can't recall if it was just 'current' API usage or dynamic mode that resulted in no Text available
s
except that I am successfully retrieving a handful of other text fields in this same code spot
like
po.getCurrentSublistText({ sublistId: 'item', fieldId: 'units' });
gives me "Ea" not the internal id
actually a handful was a lie, that looks like the only getText field I have, but it works
s
being a native field, perhaps that makes it special
s
So you think if I used getSublistText instead of getCurrentSublistText then it would work? It didnt work changing just the one line but I assume I'd have to restructure this entire bit of code for that change to actually work
like bc right now i have
po.selectLine({ sublistId: 'item', line: i });
at the beginning
I would have to load the PO not in dynamic mode? idk
didnt work
b
are your item options setup via the item options field on the item or is it a matrix item option
s
To be honest I am not sure how to tell the difference
But I can tell you I'm getting the options by loading the item and getting the field "itemoptions"