Kaizen #32 - Handling Custom Modules with Zoho CRM #API

Kaizen #32 - Handling Custom Modules with Zoho CRM #API

Hello everyone!

Welcome back to another post in the Kaizen series.
This week we are going to dive deep in exploring the custom modules and the possible operations that you can perform in API with them.

Zoho CRM offers more than ten standard modules for different purposes like Sales, Marketing, and so on. However, in some scenarios, they do not satisfy the requirements. In such cases, Zoho CRM lets you create custom modules to meet your business needs..

In this post, we will discuss the following things related to a custom module:
1. Insert a record
2. a) Update multiple records
    b) Update a specific record
3. a) View all the records
    b) View a specific record
4. a) Delete multiple records
    b) Delete a specific record
5. Upload an attachment

We will be considering the 'Student' module as our custom module, and hence all the input samples and responses will be about the student module. The fields in our Students module are:

S.No.
Field Label
Data Type
1
Attendance
Percent
2
Created By
Single Line
3
Email
Email
4
Email Opt Out
Boolean
5
Marks
Number
6
Modified By
Single Line
7
Phone
Phone
8
Secondary Email
Email
9
Student Image
Student Image
10
Student Name
Single Line
11
Student Owner
Lookup

The following image gives an overview about the Web UI of our custom module.



1. Insert a record in the Custom Module

We begin with discussing how to insert a record in the custom module. The procedure is similar to that of inserting a record in any standard module. We need the api_name of our custom module. We use the modules API that lists all the modules available in our org to fetch the. We then need to search for the name of our custom module. The value of the key "api_name" gives the API name of your custom module. In our case, the custom_module_API_name is "students."

Request URL : {{api-domain}}/crm/v2/{custom_module_API_name}
Request Method POST 
Sample URL : {{api-domain}}/crm/v2/students
Sample Request Body : 
{
    "data": [
        {
            "Name": "Jack",
            "Phone": "9876543210",
            "Email": "jack.geller@zohocorp.com",
            "Attendance": 87,
            "Marks":90,
            "Owner":
            {
                "name": "Patricia Boyle",
                "id": "3719520000000191015",
                "email": "patricia.boyle@zohocorp.com"
            }
        }
    ]
}

Sample Response:
{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2020-04-30T12:35:34+05:30",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                },
                "Created_Time": "2020-04-30T12:35:34+05:30",
                "id": "3719520000000711023",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                }
            },
            "message": "record added",
            "status": "success"
        }
    ]
}

2a. Update a specific record in the Custom Module

In this section, we will update a specific record in the Custom Module. The procedure is similar to Update a Specific Record API that we use for any Standard Module. We will be requiring record_id of the specific record that we are going to update.The ids of the records can be retrieved from Get Records API.

Request URL : {{api-domain}}/crm/v2/{custom_module_API_name}/{record_id}
Request Method PUT 

Sample URL: {{api-domain}}/crm/v2/students/3719520000000711016
Sample Request Body:
{
    "data": [
        {
            "Name": "Jackson",
            "Phone": "9876543212",
            "Email": "jack.geller@zohocorp.com",
            "Attendance": 89,
            "Marks": 90
        }
    ]
}
Sample Response:
{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2020-04-30T13:48:26+05:30",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                },
                "Created_Time": "2020-04-30T12:29:45+05:30",
                "id": "3719520000000711016",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                }
            },
            "message": "record updated",
            "status": "success"
        }
    ]
}


2b. Update multiple records in Custom Module

In this section, we will update multiple records in a custom module. We use Update Records API to update multiple records in the custom module. We must specify the IDs of the records along with data of those records that we want to update in the input body.The records can be fetched using Get Records API.

Request URL : {{api-domain}}/crm/v2/{custom_module_API_name}
Request Method :  PUT 

Sample URL: {{api-domain}}/crm/v2/students
Sample Request Body:
{
    "data": [
        {
            "id": "3719520000000711016",
            "Attendance": 95
        },
        {
            "id": "3719520000000711023",
            "Attendance": 89
        }
    ]
}
Sample Response:
{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2020-04-30T13:44:44+05:30",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                },
                "Created_Time": "2020-04-30T12:29:45+05:30",
                "id": "3719520000000711016",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                }
            },
            "message": "record updated",
            "status": "success"
        },
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2020-04-30T13:44:44+05:30",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                },
                "Created_Time": "2020-04-30T12:35:34+05:30",
                "id": "3719520000000711023",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "3719520000000191015"
                }
            },
            "message": "record updated",
            "status": "success"
        }
    ]
}


3a. View all the records in the Custom Module

In this section, we will retrieve all the records in a custom module. The procedure is similar to that of listing all the records in any standard module.

Request URL : {{api-domain}}/crm/v2/{custom_module_API_name}
Request Method GET 

Sample URL : {{api-domain}}/crm/v2/students
Sample Response:


3b. View a specific record from the Custom Module

In this section, we will retrieve the details of a specific record in the custom module.We will be requiring record_id of the specific record that we want to view.The ids of the records can be retrieved from Get Records API

Request URL: {{api-domain}}/crm/v2/{custom_module_API_name}/{record_id}
Request Method GET 

Sample URL: {{api-domain}}/crm/v2/students/3719520000000711023
Sample Response:


4a. Delete multiple records from the Custom Module

In this section, we will delete multiple records from the custom module. We must specify the ids of the records to be deleted. The ids of the records can be retrieved from Get Records API.

Request URL : {{api-domain}}/crm/v2/{custom_module_API_name}?ids={record_ids separated by commas}
Request Method DELETE 

Sample URL : {{api-domain}}/crm/v2/students?ids=3719520000000711016,3719520000000711004
Sample Response:
{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "3719520000000711016"
            },
            "message": "record deleted",
            "status": "success"
        },
        {
            "code": "SUCCESS",
            "details": {
                "id": "3719520000000711004"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}


4b. Delete a specific record from the Custom Module

In this section, we will discuss deleting a specific record from the custom module.We must specify the record_id of the records to be deleted. The id of the record can be retrieved from Get Records API.

Request URL : {{api-domain}}/crm/v2/{custom_module_name}/{record_id}
Request Method DELETE 

Sample URL : {{api-domain}}/crm/v2/students/3719520000000711044
Sample Response:
{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "3719520000000711044"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}


5. Uploading an attachment to the Custom Module

In this section, we will upload an attachment to the custom module. Specify the record_id to which the attachment needs to be added. The id of the record can be fetched from Get Records API.

Request URL : {{api-domain}}/crm/v2/{custom_module_name}/{record_id}/Attachments
Request Method POST 

Sample URL : {{api-domain}}/crm/v2/students/3719520000000722003/Attachments
Note : Add the file to be uploaded as a multi-part file.

Sample Response:





We hope you found this post useful. Keep a tab on this series for more exciting topics!

Reach out to us at support@zohocrm.com if you have any questions, or let us know in the comment section.

Cheers!






















                            Zoho Desk Resources

                            • Desk Community Learning Series


                            • Digest


                            • Functions


                            • Meetups


                            • Kbase


                            • Resources


                            • Glossary


                            • Desk Marketplace


                            • MVP Corner


                            • Word of the Day



                                Zoho Marketing Automation


                                        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 WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • 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