Update Multiple Fields
Table of Contents
Note: This task is applicable only to Zoho Creator.
Overview
The Update Multiple Fields Deluge task updates multiple field values of a record with the provided input, in a single Deluge statement. This cuts down the execution time and allows for more efficiency.
Note: Records need to be fetched using the Fetch Records task before they can be updated.
Syntax
To update the field values in the first record stored in a collection variable:
update <collection_variable> [ <field_link_name_1> = <expression1> <field_link_name_2> = <expression2> <field_link_name_3> = <expression3>; ... ];
To update field values in every record of a form/collection, use the For each record syntax after you've fetched the required records:
for each <loop_variable> in <form_link_name>[<criteria>] //<collection_variable> can also be used
instead of <form_link_name> if required { update <loop_variable> [ <field_link_name_1> = <expression_1> <field_link_name_2> = <expression_2> ... ]; }
To update the first record from a set of filtered records of a form:
update <form_link_name>[<criteria>] [ <field_link_name_1> = <expression1> <field_link_name_2> = <expression2> ... ];
Parameters
Parameter | Data Type | Description |
<form_link_name> | STRING | Link name of the form which has the stored data that needs to be updated. |
<criteria> | - | Condition based on which a set of records are fetched and updated. |
<collection_variable> | STRING | Collection variable holding the set of fetched records. |
<field_link_name> | STRING | Link name of the field whose value will be updated. Unsupported fields : Auto number, Formula, Notes, AR, fields within a Subform, Prediction, Keyword Extraction, Sentiment Analysis, OCR, Object Detection Note:
|
<expression> | Datatype differs based on the Creator field | Value to be assigned to the field. The values should conform to the Creator field's properties. For example, if you've configured a Number field to accept a maximum of 12 digits in its field properties, the expression should also abide by the limit. You can directly specify a value, or you can specify an expression, i.e. a combination of values, constants, variables, operators, functions and so on, which evaluates to a value. |
<loop_variable> | STRING | Variable to hold an individual record for each iteration. It is advised to use unique loop variables, and these need not be declared initially. |
Supported Events
When a record is Created | |
On Load | No |
On Validate | Yes |
On Success | Yes |
On User input | No |
Subform on add row | No |
Subform on delete row | No |
When a record is Created or Edited | |
On Load | No |
On Validate | Yes |
On Success | Yes |
On User input | No |
Subform on add row | No |
Subform on delete row | No |
When a record is Edited | |
On Load | No |
On Validate | Yes |
On Success | Yes |
On User input | No |
Subform on add row | No |
Subform on delete row | No |
When a record is Deleted | |
On Validate | No |
On Success | Yes |
Other workflow events | |
On a scheduled date | Yes |
During approval process | Yes |
During payment process | Yes |
For batch workflow | Yes |
In a Custom Function | Yes |
In an Action item in report | Yes |
Examples
1. The following script updates two name fields and an image field of all records in the Creator form - Employees.
for each rec in Employees[ID!=0] { update rec [ Manager.first_name = "Scott" // for composite fields, update each subfield Manager.last_name = "Wasowski" Assistant_Manager.first_name1 = "Alicia" // consequent subfields get appended
with numbers Assistant_Manager.last_name1 = "Tamizh" Manager_Signature = <img src = "https://example.com/imageSource.jpg" border = "0"></img>
//image field ]; }
where
- Employees is the link name of the form from which the records were fetched
- rec is the loop variable that holds a single record for each iteration
- Manager.first_name, Manager.last_name, Assistant_Manager.first_name1, Assistant_Manager.last_name1, and Manager_Signature are the field link names of the fields that are updated
2. The following script updates the lookup field, multi-select field, and URL field of all the filtered records in a collection variable.
var = Entries[Symptoms=="Heart Issue"]; for each rec in var { update rec [ Assigned_Doctor = 4364236000000551029 // lookup field value should be the target record_ID Tests = {"Tox Screen", "CT", "ECG"} // values other than predefined choices can also be
mentioned for multi select field URL = <a href="https://example.com" >Terms and Conditions</a> ]; }
where:
- var is the collection variable holding the fetched records
- Entries is the link name of the form from which the records were fetched
- Symptoms=="Heart Issue" is the criteria using which records are fetched
- rec is the loop variable that holds a single record for each iteration
- Assigned_Doctor, Tests, URL are the field link names of the fields that are updated
3. The following script updates the Drop Down and Percent fields of a unique record in a collection variable.
update Car_Evaluation[Owner="Ms.Portia Lance"] [ Vehicle_Condition = "Very Good" Discount = 13 ];
where:
- Interviewees is the link name of the form from which the records were fetched
- Depreciation_Rate<=20 is the criteria using which records are fetched
- Vehicle_Condition and Discount are the field link names of the fields that are updated
Usecase
Let's say you've built a Recruitment Tracker Creator application. While a mass drive is conducted, you want to assign batches of interviewees to different interviewers. Further, you want to update the date on which they need to come in and the interview rooms they will be reporting to. Instead of manually updating the records of data, the Update Multiple Fields task can be used to update all the required fields using a Deluge statement.
Implementation
Say the Recruitment Tracker application has been created using Creator. You need to update the following fields in the Interviewees form:
- Interviewer
- Reporting Time
- Interview Room
You will need to fetch the required records first before updating them. A workflow with a Deluge script will help you do this.
batch_1 = Interviewees[Batch_Number == 1]; for each singlerec in batch_1 { update singlerec [ Interviewer = "Cillian Shelby" Reporting_Time = "09:30:00" Interview_Room = ">Skyline Tower" ]; } batch_2 = Interviewees[Batch_Number == 2]; for each onerec in batch_2 { update onerec [ Interviewer = "Grace Wallis" Reporting_Time = "10:30:00" Interview_Room = "Lakeview Tower" ]; } batch_3 = Interviewees[Batch_Number == 3]; for each rec in batch_3 { update rec [ Interviewer = "Arthur Anderson" Reporting_Time = "13:00:00" Interview_Room = "Sand Tower" ]; }
where:
- batch_1, batch_2, and batch_3 are the variable that denotes the different batches of interviewees'Interviewees is the field link name of the form from which the records were fetched
- Batch_Number == 3 is the criteria using which different batches of interviewees are fetched
- singlerec, onerec, and rec are the loop variables holding a single record for each iteration
- Interviewer, Reporting_Time, and Interview_Room are the field link names of the fields that are updated
Points to Note
- Drop Down, Radio, Multi Select, and Checkbox fields: Values other than the ones configured in the fields' properties can always be specified for Multiselect and Checkbox. This is applicable for Drop Down and Radio fields too, regardless of Allow Other Choice being enabled/disabled in the field's properties.
When values other than those configured in the fields' properties are specified, they will only be stored in the record. It will not be stored as a choice in the Creator field's properties and therefore cannot be retrieved if the value is modified again. - File Upload, Audio, and Video fields - A file value fetched from another identical field type should be specified as a value. Alternately, the invokeURL task can be used to fetch a file object from another Creator application or external service as well.
- URL field's value can be given in :
HTML format - An anchor tag can be used to specify hyperlinked URLs. Format:
<a href= \"<URL>\" title = \"<TITLE>\" target = \"_blank\"><linkname></a>
- Plain text format - URLs as such without the tag can be specified in double quotes only in "On success", "On create", "On edit", and "On create or edit" workflow events.
Image field - Regardless of configuring how an image needs to be uploaded (Local computer, Link, Camera) in the Creator field's properties, specify the URL as the field value in this task. Make sure to include only a public image. Format:
<a href="https://www.example.com"> <img src="example.jpg" alt="Example Image"> </a>
- For updating data within Creator using a lookup field, or from another supported service using integration fields, the field value should be the target record's ID.