Choose where you’d like to start

Update records in bulk in Zoho CRM

Overview

The zoho.crm.bulkUpdate task updates multiple records in Zoho CRM under the specified module. This task is based on Zoho CRM Update Records API. 

Note: Using this task, you can update up to 100 records at a time.

Use Case Scenario

Let us assume that a user would like to update multiple Zoho CRM records (say Leads) simultaneously. This can be achieved through the zoho.crm.bulkUpdate task. More details on how to execute this task are explained below.

Syntax

<variable> = zoho.crm.bulkUpdate(<module_name>, <records_value>, <options_map>, <connection>);

where,

ParamsData TypeDescription

<variable>

KEY-VALUE

specifies the response returned by Zoho CRM. It represents the status of the task, the IDs of the updated records along with the values of the fields against its respective API names.

<module_name>

TEXT

specifies the API name of the CRM module, where the records will be updated.

<records_value>

LIST

specifies the list containing key-value pairs with the key as each field's API name and its corresponding value. For ex: {"Last_name":"Zoho CRM"}

The ID of the record which need to be updated must be included here in each map value in the format: {"id" : <recordID>}

Learn how to fetch the ID of a record after creating it or fetching it. 

<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 records are updated.

Applicable key is trigger, and applicable values are workflowapproval, and blueprint

When this param is specified, the mentioned values will get executed. When this param is not specified, only approvals and blueprints 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 Zoho CRM connection required to accomplish the task

Note: This field is not employed in Zoho Creator.

Example 1: Updating a Lead in Zoho CRM

Let’s take a look below at an example of updating two leads in Zoho CRM from outside it.

//List for containing the data map for bulk update 
updateList  =  List(); 
//Data Map for Lead#1 
recordMap1 =  {"id":"3171565000000600001",  "Company":"Zylker",  "Last_Name":"Daly", "First_Name":"Paul", "Email":"p.daly@zylker.com"};
//Data Map for Lead#2 
recordMap2  =  {"id":"3171565000000600002", "Company":"Tycoon", "Last_Name":"Richard", "First_Name":"Brian", "Email":"brian@villa.com"};
//Add both leads' data to a list
updateList.add(recordMap1);
updateList.add(recordMap2);
leadInfo = zoho.crm.bulkUpdate("Leads", updateList);

 

where,

leadInfo
is the variable which will hold the response returned by Zoho CRM
recordMap1 
recordMap2
are KEY-VALUE pairs that contain the data for updating the lead records
updateList
is a LIST variable that contains the KEY-VALUE pairs
"Company" 
"Last_Name" 
"First_Name" 
"Email" 
are API names of Zoho CRM Lead fields of type TEXT
"Leads"
is the TEXT that represents the name of the CRM module where the records will be updated

Note: The following modules follow a similar process of updating records, as explained in the above example:

  • Leads
  • Potentials
  • Products
  • Accounts
  • Contacts
  • Campaigns
  • Vendors
  • Cases

Response Format

Following is a successful response when records are updated in bulk in Zoho CRM:

{
"code": "SUCCESS",
"details": {
"Modified_Time": "2018-07-11T18:06:04+02:00",
"Modified_By": {
"name": "Rodriguez",
"id": "3171565000000152015"
},
"Created_Time": "2018-07-11T18:06:04+02:00",
"id": "3171565000000600000",
"Created_By": {
"name": "Rodriguez",
"id": "3171565000000152018"
}
},
"message": "record updated",
"status": "success"
},
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2018-07-11T18:06:04+2:00",
"Modified_By": {
"name": "Rodriguez",
"id": "3171565000000152015"
},
"Created_Time": "2018-07-11T18:06:04+02:00",
"id": "3171565000000600001",
"Created_By": {
"name": "Rodriguez",
"id": "3171565000000152018"
}
},
"message": "record updated",
"status": "success"

}

Below is the response returned when a record is updated without a required field. To know more about error codes, click here.

{
"code": "MANDATORY_NOT_FOUND",
"details": {
"api_name": "Last_Name"
},
"message": "required field not found",
"status": "error"
}

Related Links

  • To fetch the string value to which the specified key is mapped, use get()
  • To get values from fetched records, use getJSON()

Get Started Now

Execute