Add | Append
Note: This task is applicable only to Zoho Creator.
Overview
The Add deluge task replaces all the existing choices in a single-select, multi-select field or a lookup field type with specified choices.
The Append deluge task appends specified choices to the existing choices in a single-select, multi-select or a lookup field type.
Note:
- Only the first add command in each script action will remove the previous choices
- The same choice cannot be added or appended twice
- It is advisable to use the clear task before using the add task, to make sure the choices are cleared before the new choices are added.
Syntax
To add items
To append items
Parameter | Description |
---|---|
<field_link_name> | Link name of the field to which choices need to be added or appended. Only the following field types can be specified:
|
<expression> | Choice(s) to be added or appended to the field. Points to keep in mind for this param:
|
This task can be used in the following events
When a record is Created | ||
On Load | Yes | |
On Validate | No | |
On Success | No | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Created or Edited | ||
On Load | Yes | |
On Validate | No | |
On Success | No | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | No | |
On Success | No | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | No | |
On Success | No | |
Other workflow events | ||
On a scheduled date | No | |
During approval process | No | |
During payment process | No | |
In a Custom Function | No | |
In an Action item in report | No |
Example 1
In the following example, "colors" is a form field of drop-down type. "Get_Bright_Colors" is a decision-box field type, which when checked, adds one set of colors to the "colors" field and adds another set if unchecked.
if(Get_Bright_Colors) { addColors = {"white", "orange", "yellow"}; } else { addColors = {"Brown", "Black", "Grey"}; } clear colors; colors:ui.add(addColors);
Example 2
If "product" is drop-down field with options "Zoho CRM", "Zoho Creator" and "Zoho Desk", the following script appends "Zoho Cliq" to the options. The "product" field will then have "Zoho CRM", "Zoho Creator", "Zoho Desk" and "Zoho Cliq" as the choices.
product:ui.append("Zoho Cliq");
Example 3: Dynamically populate values of a picklist
Let's assume:
- Countries form stores the name of the Countries.
- States form stores the name of the states for the respective Countries.
- 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 the Registration Form.
clear States; statelist = States[Country_Name == input.Countries] sort by State; States:ui.add(statelist.ID.getall());
- The UI.append task does not implicitly clear the old items and hence you need to explicitly invoke the clear task.
- If Items field is a lookup or dropdown field and does not contain the value passed to the append task, the append operation will fail.
Example 4: Dynamically populate values of picklist in subform
Let's assume:
- Products for store product details with product code and category.
- Subform of the Orders form consists of fields to store order details
The goal is to populate the Items picklist in the subform based on the selected category. 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 Category field in the subform of Orders form.
itemlist = Products[Category == row.Category] sort by Product_Code; clear row.Items; row.Items:UI.append(itemlist.Product_Code.getall());