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.

Example

Let us take the example of Dynamic Picklist application. The Countries form stores the name of the Countries. States form stores the name of the states for the respective Countries. The Registration form consists of fields to store user information. The goal is to populate picklist entries for States field dynamically, based on the selected country. To add the picklist dynamically, you can either set a filter as shown here, or add the following script in the On User Input action of Countries field in Registration Form.

statelist = States [Country_Name == input.Country] sort by State_Name;
States:ui.add(statelist.ID.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.

Example

Below is an example code that can be specified in the On User Input action of a 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