Creator Help

Add To Picklist Dynamically

Overview

By default, a picklist field of type "Lookup", will display all the values present in the lookup field. The deluge ui.add / ui.append task is used in on user input field action script and on load form action script, to add an item to a picklist / radio button / checkbox / multiselect lookup field. For example, in the SubmitFeedback form given below, each issue submitted is assigned to a specific team member belonging to a specific module. When a Module is selected from the Module Name picklist, only those team members belonging to the selected module will be listed in the Assign To picklist. This is achieved using the <picklist fieldname>:ui.add(value) Deluge syntax.

Alternatively, you can also specify the Deluge criteria in the Set Criteria option of the lookup field, to create dynamic picklist.

 

Syntax - To add items to a picklist in a Normal Form

Use the following syntax to add items to a picklist within a Normal form :

<picklist field>:ui.add(value);

  • <picklist fieldname> is the name of the picklist field in the current form.
  • <value> is the value to be added to the above picklist.

Below is an example code that should be specified in the onUserInput action of Form field to create a dynamic picklist.

statelist = State [Country_Name == input.Country] sort by State_Name;
Clear State;
State:ui.add(statelist.State_Name.getall());

Note:

  • You cannot import a picklist field into another form.
  • Alternatively, you can use the Set Criteria option of the lookup field, to create dynamic picklist.

Syntax - To add items to a picklist in a Subform

Use the following syntax to add items to a picklist within a subform:

row.<picklist field>:UI.append(<LIST VARIABLE>/<STRING VARIABLE>);

  • <picklist fieldname> is the name of the picklist field in the current form.
  • <List variable>/<String Variable> is the value to be added to the above picklist.

Below is an example code that should be specified in the onUserInput action of subform picklist field.

list = Product [Category == row.Category] sort by Product_Code ;
clear row.Items;
row.Items:UI.append(itemlist.Product_Code.getall())

The UI.append task does not implicitly clear the old items and hence you need to explicitly invoke the clear task. If Items is a lookup or dropdown field and do not contain the value passed to the append task then the append operation will fail.

Example

The sample application "Order Management" illustrates the subform feature.

Top