Hi All, Can we use getSublistField in suitelet? I ...
# suitescript
s
Hi All, Can we use getSublistField in suitelet? I am trying to use this API in suitelet to disable particular sublist field but it's not working. Please help.
r
It looks like that API gets a field on a particular line. Are you trying to disable the field on a given line, or the entire column?
You probably want to use
scriptContext.form
rather than
N/record
.
form.getSublist(...).getField(...)
I think is what I've generally used.
s
^^ that would be the advice for a user event. if you have a suitelet then you probably are building the form so you’d disable it when you add the field to the sublist
1
s
Field on a given line
s
try a client script instead. but you’ll probably have to mess with the DOM directly to make it happen
👍 1
r
That can be done in SS1.0 only.
Or DOM hackery.
s
Ok, any other solution to disable particular sublist field?
r
I would avoid disabling a field on a given line. It's hacky and can only be done reliably in SS1.0. I would use a client script to validate data entry. So if you want to prevent a user updating fieldY if fieldX === 0 or what have you, you can use a dialog message and prevent them from changing that field.
Client scripts are HARD to get right, but I would just play around with the entry point functions. For most use cases you would want to return if
runtime.executionContext !== runtime.ContextType.USER_INTERFACE
.