Bulk Update Records in Zoho CRM

Bulk Update Records in Zoho CRM

Overview

Update records in bulk in Zoho CRM, using zoho.crm.bulkUpdate() task in Zoho Creator.

Syntax

<variable> = zoho.crm.bulkUpdate(<module_name>, <data_map_list>, [<optional_data_map>]);

where,

ParamsDescriptionData Type

<variable>

is the response returned as a list of key-value pairs containing the status of the task, the ID of the updated record along with other relevant details

LIST

<module_name>

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

Leads

Deals

Products

Contacts

Campaigns

Vendors

Accounts

Cases

Quotes

Sales_Orders

Purchase_Orders

Invoices

Note: Refer this for the instructions to get API names of the CRM modules and fields.

STRING

<data_map_list>

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

The IDs of the records which need to be updated must be specified along with the other key value pairs in each data map.

LIST

<optional_data_map>

(optional)

represents a key value pair which contains optional data other than what is provided in data_map_list

MAP

Example 1: Updating a Lead in Zoho CRM

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

//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 a LIST that contains data KEY-VALUE pairs
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 name of the CRM module where the record will be updated.

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

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

Response Format

The response returned is of the following format:

{
"code": "SUCCESS",
"details": {
"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_created>,
"Created_By": {
"name": <User_Name>,
"id": <user_id>
}
},
"message": "record updated",
"status": "success"
},
{
"code": "SUCCESS",
"details": {
"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 created>,
"Created_By": {
"name": <User_Name>,
"id": <user_id>
}
},
"message": "record updated",
"status": "success"
}

Following is a sample 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 a sample failure response when a record is updated without a mandatory field.

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

Related Links

  • To learn more about error codes, click here.
  • To fetch the string value to which the specified key is mapped, use get()
  • To get values from fetched records, use getJSON()

Share this post : FacebookTwitter

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

Write to us: support@zohocreator.com