Update Records in Zoho CRM

Update Records in Zoho CRM

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.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.updateRecord(<module_name>, <record_ID>, <data_map>, {<optional_data_map>}, <connections>);

where,

Params Description

<response> 

is the response returned as MAP by Zoho CRM.

<module_Name> 

is the API name of the CRM module, of STRING datatype, where the records will be updated. Following is the list of supported modules.

Leads

Potentials

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

Sales_Orders

Purchase_Orders

Invoices

<record_Id>

is the record id, of NUMBER datatype, that needs to be updated.

<data_map>

Input map with key as each field's API name and its updated value. For ex: {"Last_name":"Zoho CRM"}

<optional_data_map>

         (optional) 

Represents all the other data in a map other than input MAP.

<connections> 

Displays the connectors associated with the function. Datatype is STRING.

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.updateRecord("Leads",input.Lead_ID,leadinfo);

where,

leadinfo
contains key values pairs, where the keys are API names of Zoho CRM fields and values are updated field inputs.
response
is the response returned as map by Zoho CRM. The fetched records will be contained in the response. Check sample response here.
"Leads"
is the label name of Zoho CRM Leads Module, of string datatype, where the records will be updated.
input.Lead_ID
refers to the Form field(Lead) input.

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("Account_Name", {"id":input.CRM_ACCOUNT_ID);productsList = List:Map(); 
 
for each product in input.Product_Details 
{ 
Product_Details = map(); 
Product_Details.put("product", {"id":product.CRM_PRODUCT_ID);Product_Details.put("quantity", product.Quantity); 
productsList.add(productDetails); 
} 
quoteDetails.put("Product_Details", productsList); 

response = zoho.crm.updateRecord("Quotes", QuotesID, quoteDetails);

where,

response
is the response returned as map by Zoho CRM. The fetched records will be contained in the response. Check sample response here.
"Subject" 
"Account_Name" 
"product" 
"quantity" 
"Product_Details"
are API names of Zoho CRM fields. They are of string data-type.
input.Subject 
input.CRM_ACCOUNT_ID
are Zoho Creator field inputs.
input.Product_Details
is Subform field input.
product
stands for each subform entry or record.
product.CRM_Product_ID 
product.Quantity
are unique Subform field inputs for each Subform entry or record.
productsList
is a list variable containing map values of subform field inputs.
"Quotes"
is the CRM module, of string datatype, where the record will be updated.
response
is response returned as map by Zoho CRM. Check sample response here.

Response Format

The response returned is of the following format:

{  
   "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"
   }
}

Limitation

CRM Tasks can be executed only in accounts which are under Flexible and Unlimited Plans. Accounts under Free Plan, kindly upgrade to use CRM tasks. For more details scroll down to Integration and Web Data on the pricing page.

Script Builder

You can also make use of Script builder to define the zoho.crm.updateRecord() task. Navigate to your application’s Workflow and drag and drop the Call Function under Deluge Tasks > Miscellaneous. Select Integration tasks and fill out necessary information.

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().

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com