I would like to dynamically load Select options fo...
# suitescript
a
I would like to dynamically load Select options for locations based on a subsidiary selection. the field.addSelectOption is not available on the Client Script per the documentation. any ajax type functionality
If anyone has done any type of dynamic loading of select field based on selection on another field, please let me know how you did that.
j
Copy code
var field = currentRecord.getField(...)
field.removeSelectOption(...);
field.insertSelectOption(...);
z
User Event Script before load is your best bet
var form = context.form
form.getField().insertSelectOption(...)
With this method, you would refresh the page once the subsidiary is set
a
Thank you @jkabot and @zach_calh! I like these options!
z
i should clarify that the method I mentioned uses
addSelectOption()
not
insertSelectOption
b
As an alternative approach, I recommend no scripting
Use a custom field and use the filtering options
You can filter the select options based on the value of another field
In your example, you can add a multiple select field on the location which stores the subsidiaries that are select able on that location.
Then on your custom location field, you would add a filter on the custom location field where its value is equal to the subsidiary field you wish to filter on
a
Thank you @battk ! I hadn't looked into Multiselect but looks like an interesting option. It is not available on suitelets but i might use it for other projects.