Update Related Record
Table of Contents
Description
This task is used to update a record in a submodule related to a record in a parent module in Zoho CRM. For example, a record from the submodule - Price books related to the parent module - Products can be updated using this task. You can find all the other supported relations in Zoho CRM API document.
Syntax
<variable> = zoho.crm.updateRelatedRecord(<sub_module>, <sub_module_record_id>, <parent_module>, <parent_module_record_id>, <values>, <connection>);
where,
Params | Data type | Description |
<variable> | KEY-VALUE | 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. |
<sub_module> | TEXT | specifies the API name of the sub module in which the record will be updated. |
<sub_module_record_id> | NUMBER | 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. |
<parent_module> | TEXT | specifies the API name of the parent module to which the sub module belongs. |
<parent_module_record_id> | NUMBER | specifies the ID of the parent module record whose related record needs to be updated. Learn how to fetch the ID of a record after creating, searching or fetching it. |
<values> | KEY-VALUE | specifies the new values of the sub module record. |
<connection> (Optional) | TEXT | specifies the name of the connection Note: The <connection> field is not employed in Zoho Creator. |
Example
The following script updates the field - 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"
4770XXXXXXXXXX
Note: Refer this page for the instructions to get API names of the CRM modules and fields.
Response Format
Success Response
The success response returned is of the following format
{
"Modified_Time":"2018-12-11T12:15:02+05:30",
"Modified_By":{"name":"John","id":"2303XXXXXXXXXX"},
"Created_Time":"2018-12-06T19:01:45+05:30",
"id":"2303XXXXXXXXXX",
"Created_By":{"name":"John","id":"2303XXXXXXXXXX"}
}
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"
}