Update Record in Zoho CRM
Table of Contents
Description
This task updates the values of a particular record using its ID in the specified module of Zoho CRM.
Syntax
<variable> = zoho.crm.updateRecord(<module_name>, <record_ID>, <record_value>, <options_map>, <connection>);
where,
Params | Data type | Description |
<variable> | KEY-VALUE | specifies the response returned by Zoho CRM. It represents the record's creation and modification details against the API names of the respective fields. |
<module_Name> | TEXT | specifies the API name of the Zoho CRM module where the records will be updated |
<record_Id> | NUMBER | specifies the ID of the record that will be updated. Learn how to fetch the ID of a record after creating , searching or fetching it. |
<record_value> | KEY-VALUE | specifies the input map with key as each field's API name and its updated value. For ex: {"Last_name":"Zoho CRM"} Note: Refer this page for field names in each module. |
<options_map> (optional) | KEY-VALUE | Represents other options data(like trigger). This param can be used to selectively allow the execution of scripts(if any) when the record is updated. Applicable key is trigger, and applicable values are workflow, approval, blueprint, and orchestration. When this param is specified, the mentioned values will get executed. When this param is not specified, only approvals, blueprints, and orchestration will get executed by default. To restrict all the scripts from getting executed, specify empty list as value to the "trigger" key. |
<connection> (optional) | TEXT | specifies the name of the connection Note: The field <connection> is not employed in Zoho Creator. |
Example
The following script updates the record with ID - 23033XXXXXXXXXXXXXX of the Zoho CRM module - Leads.
leadinfo = { "Company":"Zylker", "Last_Name":"Stewart", "Phone":"9876XXXXXX", "Email":"stewart@zylker.com" }; response = zoho.crm.updateRecord("Leads",23033XXXXXXXXXXXXXX,leadinfo);
where,
leadinfo
response
"Leads"
23033XXXXXXXXXXXXXX
Response Format
Success Response
The success response returned is of the following format:
{
"Modified_Time":"2018-03-26T15:17:39+05:30",
"Modified_By":{
"name":"Ben",
"id":"29383XXXXXXXXXXXXXX"
},
"Created_Time":"2018-03-26T14:39:28+05:30",
"id":"29383XXXXXXXXXXXXXX",
"Created_By":{
"name":"Ben",
"id":"29383XXXXXXXXXXXXXX"
}
}
Failure Response
Note: The sample for a few common failure cases is given below. For all possible errors, please refer to the Zoho CRM API documentation.
The failure response for incorrect or non-existent record ID will be returned in the following format:
{
"code": "INVALID_DATA",
"details": {},
"message": "the id given seems to be invalid",
"status": "error"
}
The failure response for incorrect or non-existent module name will be returned in the following format:
{
"code": "INVALID_MODULE",
"details": {},
"message": "the module name given seems to be invalid",
"status": "error"
}