Update Related Record
Table of Contents
Description
The zoho.crm.updateRelatedRecord task is used to update related lists of a parent module in Zoho CRM. The possible modules to which this task can be applied is found here.
Syntax
<response> = zoho.crm.updateRelatedRecord(<sub_module>,<sub_module_record_id>,<parent_module>,<parent_module_record_id>,<values>);
where,
| Params | Description | Data type |
<response> | specifies the response message returned by Zoho CRM. It represents the record's creation and modification details against the API names of the respective fields. | MAP |
<sub_module> | specifies the API name of the sub module in which the record needs to be updated. Note: Refer this for the instructions to get API names of the CRM modules and fields. | STRING |
<sub_module_record_id> | specifies the ID of the sub module record that needs to be updated. The record ID of the related records can be obtained from the response of Get Related Records task. | BIGINT |
<parent_module> | specifies the API name of the parent module to which the sub module belongs | STRING |
<parent_module_record_id> | specifies the ID of the parent module record whose related record needs to be updated | BIGINT |
<values> | specifies the new values of the sub module record in a map format with key as CRM field's API name and its required corresponding value. | MAP |
Example
The following script updates the record - list_price of the sub module - Price_Books which belongs to the parent module - Products.
response = zoho.crm.updateRelatedRecord("Price_Books",2303XXXXXXXXXXXXXXX,"Products",4770XXXXXXXXXXXXXXX,{"list_price":200});
where,
response"Price_Books"2303XXXXXXXXXX"Products"4770XXXXXXXXXXResponse Format
The response returned is of the following format:
"Modified_Time": <Date/Time in ISO 8601 format>,
"Modified_By": {
"name": <User_Name>,
"id": <user_id>
},
"Created_Time": <Date/Time in ISO 8601 format>,
"id": "id of the record updated",
"Created_By": {
"name": <User_Name>,
"id": <user_id>
}
}
The following is a sample response when a sub module is updated in the Products module in Zoho CRM:
"Modified_Time":"2018-03-26T15:17:39+05:30",
"Modified_By":{
"name":"Ben",
"id":"2938383000000132011"
},
"Created_Time":"2018-03-26T14:39:28+05:30",
"id":"2938383000000392001",
"Created_By":{
"name":"Ben",
"id":"2938383000000132011"
}
}
Failure Response
The failure response returned for incorrect or non-existent record ID is of the following format
{
"code":"INVALID_DATA",
"details":{},
"message":"the related id given seems to be invalid",
"status":"error"
}
