We are trying to add select options to a suitelet ...
# suitescript
m
We are trying to add select options to a suitelet sublist field dynamically. For example: Field B list values are dependent on Field A value. The user is able to add the first row of the sublist just fine and the list values are filtered correctly for field B. The issue comes up when the user adds the second row of the sublist. If the value selected for Field B on line 1 is not available for Field B in line 2 (due to add select option filtering), the value previously selected on line 1 is cleared out. Does anyone have any ideas on how to get around this? NetSuite is doing the same kind of filtering at the sublist level on their inventory detail pop-up window.
m
I would suggest not filtering the select values and instead doing validation of the selected option either on validateField or validateLine, depending on what works best for your workflow. I think when you modify a sublist field, you're technically modifying it for all lines, which is why you're seeing the values get cleared out on previous lines.
👍 1
I know that may not be particularly user-friendly since you're not getting in front of it before the user makes a selection, but it might be your only option to preserve the data in all lines
m
agreed, that's how i've done it, otherwise you find yourself deep in DOM land....