Choose where you’d like to start

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

<field_link_name>:ui.add(<expression>);

To append items

<field_link_name>:ui.append(<expression>);
ParameterDescription
<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:

  • Radio
  • Drop Down
  • Multi Select
  • Checkbox
  • Lookup (all Display Types are supported)
<expression>

Choice(s) to be added or appended to the field.

Points to keep in mind for this param:

  • You can directly specify a single value, or to add/append more than one choice you can specify a list variable containing the choices. You can also specify an expression, i.e. a combination of values, constants, variables, operators, functions and so on, which evaluates to a value or a list variable.
  • For a lookup field, the ID of a record in the lookup form must be specified. If any other value apart from the record ID is specified, an error will encountered during runtime

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateNo
On SuccessNo
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateNo
On SuccessNo
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateNo
On SuccessNo
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateNo
On SuccessNo
Other workflow events
On a scheduled dateNo
During approval processNo
During payment processNo
In a Custom FunctionNo
In an Action item in reportNo

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()); 
Note:
  • 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());

Get Started Now

Execute