Hello, I am trying to set a dropdown field value o...
# suitescript
p
Hello, I am trying to set a dropdown field value on a sublist field in suitescript 2.0. I am getting a blank value set. What is the function to use to set a dropdown list?
s
It's the standard
setSublistValue()
call, make sure you are using the internal id of the value in the list, and not the text display. If you doing this in a client script, then you will need to use
selectLine()
first and use
setCurrentSublistValue()
p
thanks
do you need a selectline for a fieldchanged?
I can't get this code to work. I have a checkbox value and I am trying to set a dropdown sublist field
if (accrue === 'T') { rec.setCurrentSublistValue({ sublistId: 'item', fieldId: 'custcol_pi_donotaccrue', value: '1' }); }
nevermind I got it working. am I doing the getvalue of the checkbox correctly?
s
Well I dont see the
getValue()
or
getSublistValue()
call but I would always validate against
true
or
'T'
for checkbox type fields because I never know what NS is going to return.
And yes, you should still need to
selectLine()
in the scenario of field changed, it should come into the context of the function call as
context.line
p
thank you