Kaizen #57 - Mass Update API in Zoho CRM

Kaizen #57 - Mass Update API in Zoho CRM

Hello everyone!

Welcome back to yet another post in the Kaizen series.
This week, we will discuss the Mass Update API in Zoho CRM.

In this post, we will cover the following:
1. Introduction
2. Mass Update Records API 
3. Schedule Update and Get Status
4. Common errors pertaining to the Mass Update API
5. FAQs regarding the Mass Update API

1. Introduction

Generally, there can be cases where you might need to update the same field for multiple/all records in a module. To avoid the tediousness of the task, Zoho CRM offers Mass Update API to update the values of specific fields in multiple records in a module. The request requires field API names, record IDs, the custom view ID, and territory ID as input depending on the type of mass update you intend to perform. 

Mass Update can occur in 2 different ways:
a. Scheduler Type: When you specify the custom view ID and the territory ID, a job gets scheduled in the background. In the response, the system returns a "job_id" which you can use to get the status of the same. Use this job_id in the GET request to get the result. In this type of mass update, You can update a maximum of 50,000 records in a single request.

b. Non-Scheduler Type: When you specify the record IDs, the system updates the records instantly. You can update a maximum of 500 records in a single API call in this type of mass update. 

Modules supporting Mass Update APIs:
Leads, Accounts, Contacts, Deals, Campaigns, Activities, Solutions, Products, Vendors, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, and Custom.

2. Mass Update Records API

Request URL: {{api-domain}}/crm/v2/{module_api_name}/actions/mass_update

Scope Required: 
ZohoCRM.mass_update.{module_name}.UPDATE

Request JSON keys:
Key
Data Type
Description
Mandatory
cvid
string
The custom view ID whose records you want to mass update
Mandatory when you want to mass update custom view fields.
over_write

boolean
Used when updating a multi-select picklist field. Providing true will overwrite the already present value while the default false value will add the value to the pick list
Optional
territory
JSON Object
Used to update the records in a territory.
Mandatory when you update territory fields.
ids
JSON Array
Specify the IDs of the records you want to mass update. A maximum of 500 IDs can be specified in the request.
Mandatory when records are updated by IDs.

Sample Request:
{{api-domain}}/crm/v2/Leads/actions/mass_update

Sample Response:


3. Schedule Update and Get Status

Let us see how to schedule a mass update by custom view ID and check it's status:

i. Schedule mass update using 'cvid' and retrieve the 'job_id'.

Sample Request: 
{{api-domain}}/crm/v2/Leads/actions/mass_update

Sample Response:

From the response, you can see that the mass update is scheduled and the job_id to check status is 3719520000001274002

ii. Check status of the scheduled Mass Update

Request URL: 
{{api-domain}}/crm/v2/{module_api_name}/actions/mass_update?job_id={job_id}

Scope Required:
ZohoCRM.mass_update.{module_name}.READ

Note: job_id is the only mandatory parameter that must be passed to obtain the status of the process. 

Sample Request: 
{{api-domain}}/crm/v2/Leads/actions/mass_update?job_id=3719520000001251XXX

Sample Response:
i. Response right after the mass update is scheduled. The status in the response is SCHEDULED.


ii. Response once the schedule is completed. The status in the response is COMPLETED.


Response JSON Keys
Key
Description
Status
Indicates the status of mass update. Possible values are COMPLETED, SCHEDULED, RUNNING, and FAILED.
Failed_Count
Specifies the number of records that failed to be mass updated.
Updated_Count
Specifies the number of records that were successfully mass updated.
Not_Updated_Count
Specifies the number of records that are not updated yet.
Total_Count
Specifies the total number of records that were scheduled to be mass updated

4. Common errors pertaining with the Mass Update APIs and ways to handle them

HTTP Status Code
Error Code
Message
Reason
403
NO_PERMISSION
Field Edit Permission not given
User does not have permission to edit the field
403
NO_PERMISSION
Customview not accessible
Custom view is not accessible to the user of the module
400
NO_RECORDS_FOUND
No record found to update
There are no records in the specified custom view
200
ALREADY_SCHEDULED
Already a Mass Action scheduler is running for the given cvid
The records in the custom view specified are already scheduled for a mass update.
200
LIMIT_EXCEEDED
Record count exceeded
Number of records that can be mass updated has exceeded the maximum allowed limit of 50000
200
RECORD_IN_BLUEPRINT
The record is in blue print
The specified record is in blueprint and user tries to update a blueprint picklist value


5. FAQs regarding Mass Update API

Q. What happens if some record IDs that I provide are invalid?
A: While mass updating records based on their IDs, if some of the record IDs are invalid only those records will not be processed.
Sample Response when one of the ID is invalid:


Q. Can I mass update the email field in the module?
A. No, you cannot mass update Email field. The other fields that cannot be processed for mass update are lookup fields, layout fields, multi line fields, and line items.

Q. Is it possible to mass update the account owner via Zoho CRM API?
A: No, you cannot mass update the account owner via Zoho CRM API. It throws the following error:
{
    "data": [
        {
            "code": "INVALID_DATA",
            "details": {
                "api_name": "Account_Owner"
            },
            "message": "This field cannot be updated in the Mass Update",
            "status": "error"
        }
    ]
}

Q. How to set the scope for custom modules?
A. The process is similar to that of setting scope for any standard module. The scope for Mass Update API is ZohoCRM.mass_update.{module_name}.UPDATE/READ. Hence, for example, if your custom module name is 'Clients', the scope would be 'ZohoCRM.mass_update.Clients.UPDATE/READ

Q. Can I have more than one mass update job for a custom view?
A. No, only one mass update job can happen on a custom view at a given time. An error is thrown with the error code 'ALREADY_SCHEDULED'. 

We hope you found this post useful. Let us know your thoughts in the comment section or reach us out at support@zohocrm.com.

Cheers!









    Access your files securely from anywhere

        Zoho Developer Community







                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Gain control over record sharing with portal users through our new enhancement: criteria-based data exposure

                                                Dear Customers, We hope you're well! Portals is a self-service avenue through which your clients can access and manage their direct and related data in Zoho CRM. This empowers them to be more independent and enables them to experience a sense of transparency
                                              • Identify and prioritize profitable deals: Zoho CRM Forecasts help users focus on revenue-driving opportunities

                                                Dear Customers, We hope you're well! At any given time, a sales rep handles multiple deals, each progressing at its own pace. But not all deals will succeed—some will take time, and others may never close. This varying momentum directly impacts the organization’s
                                              • Context and convenience just got better with Zia's email intelligence

                                                Dear Customers, We hope you're well! We are in 2024, and email as a tool is only getting more powerful each day. While it enables seamless daily correspondences, we are here with a set of abilities that will enhance your user experience and save several
                                              • Investigate your losses using VoC's root-cause analysis

                                                Dear Customers, We hope you're well! Loss and customer churn are inevitable in any business, even for historically successful ones. While it's never pleasant to see customers leave, it's crucial for businesses to identify the triggers behind these losses
                                              • Enrich your CRM data and keep them updated

                                                You spend a lot of your time and efforts in generating quality leads for your business. While generating leads is a challenge in itself, the real deal begins when sales reps try to nurture these leads and convert them as customers. So how equipped is your sales team with information about your leads matters a lot.  For example, you might be using webforms to generate leads and collect customer information from your website. The lesser your webform fields are, the more your sign-ups right? From optimizing


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now