Update Records in Zoho CRM
Table of Contentsup
Overview
Zoho Creator and Zoho CRM have been integrated for efficient usability purposes. We have developed tasks in Zoho Creator to perform automatic actions in Zoho CRM, which would otherwise require manual execution. For example, you can update records in Zoho CRM by simply submitting a Form with relevant details in Zoho Creator. This can be achieved using zoho.crm.v1.updateRecord() task in Zoho Creator.
Use Case Scenario
Let's say we have a Zoho Creator Form which stores Leads information. To update existing Lead details in Zoho CRM you can execute the zoho.crm.updateRecord() task. The specified record is updated when the Form is submitted with updated information. Further details on how to execute this task are explained below.
Syntax
<response> =zoho.crm.v1.updateRecord(<module_name>, <record_ID>, <New values as map object>);
where,
| Params | Description | ||||||||||||
<response> | is the response returned as MAP by Zoho CRM. | ||||||||||||
<module_Name> | is the name of the CRM module, of STRING datatype, where the records will be updated. Following is the list of supported modules.
| ||||||||||||
<record_Id> | is the record id, of NUMBER datatype, that needs to be updated. | ||||||||||||
<New values as map object> | key, value pairs with updated values |
Example 1: Update a Lead record by specifying it's id
Let's assume we have a Zoho Creator Form with the following fields:
- Lead(Zoho CRM Leads field type)
- Company Name (Zoho CRM Leads field type)
- Name (Single Line field type)
- Telephone (Number field type)
- Email Address (Email field type)
Add the following script in On Add > On Success to update details of the specified Lead id.
leadinfo = {"Company":input.Company_Name, "Last Name":input.Name, "Phone":input.Telephone, "Email":input.Email_Address}; response = zoho.crm.v1.updateRecord("Leads",input.Lead_ID,leadinfo);
where,
leadinforesponse"Leads"input.Lead_ID
Example 2: Update a Quote with Product details by specifying the Quote ID
Let's assume we have a Zoho Creator Form used to store Quotes and its Products details. The Form consists of the following fields:
- Subject (Single Line field type)
- Account (Zoho CRM Accounts field type)
- Product Details (Subform field type) containing Product (Zoho CRM Products field type) and Quantity (Number field type)
Add the following script in On Add > On Success section of your Form to update an existing Quotes record:
quoteDetails = map(); quoteDetails.put("Subject", input.Subject); quoteDetails.put("ACCOUNTID", input.Account_ID); productsList = List:Map(); for each product in input.Product_Details { Product_Details = map(); Product_Details.put("Product Id", product.Product_ID); Product_Details.put("Quantity", product.Quantity); productsList.add(productDetails); } quoteDetails.put("Products", productsList); response = zoho.crm.v1.updateRecord("Quotes", QuotesID, quoteDetails);
where,
quoteDetailsproductDetails
"Subject" "ACCOUNTID" "Product Id" "Quantity" "Products"
input.Subject input.ACCOUNT_ID
input.Product_Details
productproduct.Product_ID product.Quantity
productsList"Quotes"responseExample 3: Update Attachment in an Account
Let's assume we have a Form with a File Upload field. To update an attachment in Zoho CRM's Accounts module, add the following script in On Add > On Success section of the Form:
response = zoho.crm.v1.attachFile(("Accounts"), 1560679000000413019, input.File_Upload);
where,
responseresponse"Accounts"1560679000000413019input.File_Upload
Response Format
The response returned is of the following format:
Related Links
- To fetch the string value to which the specified key is mapped, use get()
- To get values from fetched records, use getJSON()
- To convert the json string to list format, use toJSONList().
