How to clear and add values in dropdown of a subform
Assume you have a dropdown field in the subform with preset values. You can clear these options and add new ones dynamically in the UI using Deluge scripting. As a result, only the values specified in the deluge script will appear in the dropdown.

Note: Altering the dropdown values through this task is limited to the client interface, ensuring that only the UI is modified, without affecting the predefined values stored in the backend.
For example: Let’s consider the course registration application used in an educational institution. Students register for their preferred courses in a course registration form with a subform to handle and showcase enrolled courses for students. Depending on the student's academic year, the subform dynamically displays only the courses allocated for that specific year.
- Create a new workflow to execute on your preferred form event.

- Click Add New Action > Deluge Script and add the following script to the Deluge editor.
- // Create a list of values to replace the existing dropdown values
- New_Items = List();
- New_Items.add("Item 1");
- New_Items.add("Item 2");
- New_Items.add("Item 3");
- //Utilize an 'if' statement to selectively clear or add dropdown values based on a specified condition. Define your condition within the <criteria> placeholder.
- if(<criteria>)
- {
- //Clear and add the drop values
- row.<Dropdown>:ui.add(<New_Items>);
- }
Where
<New_Items> | is the LIST that contains the values that to be replaced with the existing values in the drop down. |
<Criteria> | is the conditional expression that determines whether the subsequent code within the 'if' statement should be executed. |
<Dropdown> | Is the field link name if the drop down field added in the subform |
See How it Works
- Add & Append