Update record
Table of Contents
Note: This task is applicable only to Zoho Creator.
Overview
The update record deluge task updates(replaces) the value of a specified field with the given value.
Record needs to be fetched before they can be updated.
Syntax
To update a field value in the first record in the collection variable:
To update a field value in every record in a collection:
{
<loop_variable>.<field_link_name> = <expression>;
}
Parameter | Description |
---|---|
<collection_variable> | Collection variable holding the collection of records. |
<field_link_name> | Link name of the field whose value will be updated.
|
<expression> | Value to be assigned to the field. 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. Refer this document to know the data-type of values each field type can hold. |
<loop_variable> | Variable to hold an individual record for each iteration. You can specify any variable name here, without having to declare it initially. It is advisable to not use the same loop variable used earlier. |
Applicable data-type and expression for each field
Field type | Data-type | Points to note |
---|---|---|
Name | Text | You must specify only the link name of the "Name" field when assigning it a value copied from another "Name" field. In all other cases, you have to give the values for its sub-fields separately as given below: <field>.prefix: denotes the "prefix" field. <field>.first_name: denotes the "first_name" field. <field>.last_name: denotes the "last_name" field. <field>.suffix: denotes the "suffix" field. Note:
|
Text | The format of the specified email address must be valid. If the format of the specified email address is invalid, execution will be stopped during runtime. The number of characters in the value should not exceed the length specified in the "Character maximum" field property. If it exceeds, execution will be stopped during run-time. | |
Address | Text | You must specify only the link name of the "Address" field when assigning it a value copied from another "Address" field. In all other cases, you have to give values for its sub-fields separately as given below: <field>.address_line_1: denotes the "Address Line 1" field. <field>.address_line_2: denotes the "Address Line 2" field. <field>.district_city: denotes the "City / District" field. <field>.state_province: denotes the "State / Province" field. <field>.postal_Code: denotes the "Postal Code" field. <field>.country: denotes the "Country" field. <field>.longitude: denotes the "longitude" field. <field>.latitude: denotes the "latitude" field. Note:
|
Phone | Text | Value can be specified with or without the country code, even if the "Country code options" and "Default country code" field properties are not selected. Special characters like (), and - are supported to accept different phone number formats of various countries. |
Single Line | Text | The number of characters in the value should not exceed the length specified in the "Character maximum" field property. If it exceeds, execution will be stopped during run-time. |
Multi Line | Text | The value can be plain text of maximum 64 kb size. |
Number | Number | If the number of digits specified in the value exceeds the length specified in the "Max Digits" field property, the extra digits will be trimmed from the right. |
Date | Date-time | All days in a week can be specified as value, irrespective of the selected days in "Allowed Days" property. Time value, if specified, will not get added. |
Drop Down | Text | You can specify a new choice apart from pre-defined choices even if the "Allow Other Choice" field property is not selected. If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified. |
Radio | Text | You can specify a new choice apart from existing choices even if the "Allow Other Choice" field property is not selected. If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified. |
Multi Select | Text list | You can specify a new choice apart from the pre-defined choices. If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified. |
Checkbox | Text list | You can specify a new choice apart from the pre-defined choices. If a new choice is specified as the value, it only gets saved in the record and is not added as a new choice to be selected from the form UI. And that choice cannot be retrieved back if modified. |
Decision box | Boolean | You can specify the value as True or False, with or without double quotes. If any other value is specified, execution will be stopped during run time. |
Rich Text | Text | There is no limit to the number or type of characters that can be specified as the value. |
Url | Text |
Note: Plain text format can be used only in the "On success", "On create", "On edit", and "On create or edit" workflow events. |
Image | Text | Value must be specified in the following format (title, linkname and target are optional params) : <a href= \"http://<LINKNAME>\" title =\"<TITLE>\" target = \"_blank\"><img src = \"<URL>\" title =\"<TITLE>\"></img></a> You must specify the image url as the value, even if the "Browse Options -Link" field property is not selected. The link must be that of a public image. |
Percent | Decimal | If the number of digits specified in the value exceeds the length specified in the "Max Digits" field property, the extra digits will be trimmed from the right. If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right. |
Currency | Decimal | If the number of digits specified in the value exceeds the value specified in the "Max Digits" field property, the extra digits will be trimmed from the right. If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right. |
Decimal | Decimal | If the number of digits specified in the value exceeds the value specified in the "Max Digits" field property, the extra digits will be trimmed from the right. If the specified decimal points exceed the number specified in "Decimal Points" field property, the extra decimal points will be trimmed from the right. |
Date-Time | Date-time | All days and hours can be specified as value, irrespective of the selected days and hours in "Allowed Days" and "Allowed Hours" property. If Time value is not specified, 00:00:00 will be set as the time value. |
Lookup (Display type - Dropdown/Radio Button) | Number | You must specify the record ID of the lookup form as the value. |
Lookup (Display type - Multi Select/Checkbox) | Number list | You must specify the record ID of the lookup form as the value. |
File Upload | File Upload | Only a file value fetched from another File Upload field type should be specified as a value. |
Audio | Audio | Only an audio file value fetched from another Audio field type should be specified as a value. |
Video | Video | Only a video file value fetched from another Video field type should be specified as a value. |
Users | Text | You can specify username of any user or developer added in your current app. You can view the list of users and developers in your account by navigating to Settings > Users. From this page, you can also add more users and developers to your account. If you enter an incorrect username, execution will be stopped during run-time. |
Integration (Zoho CRM) | Text | You must specify the record ID in the selected module as the value. I f you enter an incorrect ID, execution will be stopped during run-time. Learn how to fetch the ID of a record after creating it or fetching it. |
Integration (Zoho Recruit) | Text | You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time. Learn how to fetch the ID of a record after creating it or fetching it. |
Integration (Salesforce) | Text | You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time. Learn how to fetch the ID of a record after creating it or fetching it. |
Integration (Zoho Books) | Text | You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time. Learn how to fetch the ID of a record after creating it or fetching it. |
Integration (Quickbooks) | Text | You must specify the record ID in the selected module as the value. If you enter an incorrect ID, execution will be stopped during run-time. Learn how to fetch the ID of a record after creating it or fetching it. |
Things to keep in mind
- While using the first syntax, if the collection variable holds multiple records, the field value in the first added record only will updated.
This task can be used in the following events
When a record is Created | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
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 | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Edited | ||
On Load | Yes | |
On Validate | Yes | |
On Success | Yes | |
On User input | Yes | |
Subform on add row | Yes | |
Subform on delete row | Yes | |
When a record is Deleted | ||
On Validate | Yes | |
On Success | Yes | |
Other workflow events | ||
On a scheduled date | Yes | |
During approval process | Yes | |
During payment process | Yes | |
In a Custom Function | Yes | |
In an Action item in report | Yes |
Example
The following script fetches record with "Employee ID" field value as 9021, and updates the "Name" field value to "Harry John".
EmployeeDetails.Name.first_name = "Harry" ;