Kaizen #88 Assignment Rules

Kaizen #88 Assignment Rules

Hello everyone!
This week, we will discuss the use cases of assignment rules in inserting, updating, and upserting records.

What are Assignment Rules?

The effectiveness of sales is closely tied to a sales representative's daily tasks, such as promptly following up with leads and providing quick responses to customers. A crucial aspect of achieving this lies in implementing a well-structured and carefully planned lead assignment process that takes into account the diverse requirements of leads originating from different sources. Manual assignment may not be efficient, as leads should not be assigned randomly, but rather based on specific criteria like regional experience or product knowledge. "Assignment Rules" automates the lead assignment process by applying predefined rules that consider factors such as territory and product interest, thereby saving time and reducing errors.

Advantages of Assignment Rules 

Zoho CRM's Assignment Rule helps you,
  • To filter records based on the given conditions and assign corresponding owners.
  • To implement an automated system, the time taken to assign leads manually/records that meet the defined criteria can be significantly reduced, thereby making the assignment process more efficient.
  • To assign the filtered records to the specific team in your organization so that they act efficiently to convert leads into contacts and increase your business growth at the earliest possible time.

Where can we create assignment rules on the web UI?

To create an assignment rule, go to Zoho CRM > Setup > Automation > Assignment Rules.

List the Assignment Rules

To list the available assignment rules in your organization.

Request URL: {api-domain}/crm/v4/settings/automation/assignment_rules
Request Method: GET

Sample Response

 {
    "assignment_rules": [
        {
            "created_time": "2023-05-10T00:00:00-07:00",
            "modified_time": "2023-05-30T22:10:53-07:00",
            "default_assignee": {
                "name": "Logged in User",
                "id": "${CURRENTUSER}"
            },
            "module": {
                "api_name": "Leads",
                "id": "5725767000000002175"
            },
            "name": "Leads from India",
            "modified_by": {
                "name": "Patricia Boyle",
                "id": "5725767000000411001",
                "zuid": 808233918
            },
            "description": "Leads from India",
            "id": "5725767000000526437", //ID of the rule(Leads from India)
            "created_by": {
                "name": "Patricia Boyle",
                "id": "5725767000000411001",
                "zuid": 808233918
            }
        }
    ]
}

Apply the rule while creating new records using the ID of the corresponding assignment rule.

Assignment rules on records insert 

While inserting records in a module, you need to specify the ID of the assignment rule which you want to execute, in the request body of the API under the json key "lar_id".
 
Request URL: {api-domain}/crm/v4/Leads
Request Method: POST

Sample Input

{
    "data": [
        {
            "Last_Name":"Smith",
            "Country":"India",
            "Company":"A Technology",
            "Email":"smith@aaa.com",
            "Phone":"+91 87654321**"
        },
        {
            "Last_Name": "Shane",
            "Country": "Pakistan",
            "Company":"B Technology",
            "Email":"shane@bbb.com",
            "Phone":"+9230012345**"
        },
        {
            "Last_Name": "Taqi",
            "Country": "Sri Lanka",
            "Company":"C Technology",
            "Email":"taqi@ccc.com",
            "Phone":"+947123456**"
        },
        {
            "Last_Name": "Kane",
            "Country": "USA",
            "Company":"D Technology",
            "Email":"kane@ddd.com",
            "Phone":"+112345678**"
        }
    ],
    "lar_id": "5725767000000526437"
}

Sample Response

{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "Modified_Time": "2023-05-31T02:24:11-07:00",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "5725767000000411001"
                },
                "Created_Time": "2023-05-31T02:24:11-07:00",
                "id": "5725767000000619002",
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "5725767000000411001"
                },
                "$approval_state": "approved"
            },
            "message": "record added",
            "status": "success"
        },
        .
        .
        .
        }
    ]
}

Now, we have applied the rule to the new records and assigned them to their respective owner. To verify whether the records have been assigned to the owner specified in the rule, you can make an API request to GET Records API with the ID of the record. Alternatively, you can perform the verification on the web UI.


Assignment Rules on records update

Zoho CRM provides the flexibility to execute an assignment rule while updating records through its Update Records API.
In the sample request, Kane, a lead from the USA, was initially handled by John. However, Kane has now to moved to India, so Lee will become his new owner.
To achieve this, send the assignment rule ID in the 'lar_id' json key of the request body of the API as below.

Request URL : {{api-domain}}/crm/v4/Leads/{record-id}
Request Method: PUT

Note:
It is mandatory to specify the record ID of Kane to update the fields. 

Sample Input

{
    "data": [
        {
            "Last_Name": "Kane",
            "Country": "India",
            "Company":"D Technology",
            "Email":"kane@ddd.com",
            "Phone":"+9188255172**"
        }
    ],
    "lar_id": "5725767000000526437"
}

Sample Response

{

    "data": [

        {

            "code": "SUCCESS",

            "details": {

                "Modified_Time": "2023-05-31T05:46:51-07:00",

                "Modified_By": {

                    "name": "Patricia Boyle",

                    "id": "5725767000000411001"

                },

                "Created_Time": "2023-05-31T03:19:19-07:00",

                "id": "5725767000000619110",  //ID of the record

 

                "Created_By": {

                    "name": "Patricia Boyle",

                    "id": "5725767000000411001"

                }

            },

            "message": "record updated",

            "status": "success"

        }

    ]

}

To ensure that the record owner has been changed, verify the same using GET Records API.

Request URL: {api-domain}/crm/v4/Leads/{record-id}
Request Method: GET

Sample Response

{
    "data": [
        {
            "Owner": {
                "name": "Lee",
                "id": "5725767000000583018",
                "email": "lee@mail.com",
            },
            "Company": "D Technology",
            "Email": "kane@ddd.com",
            .
            .
            .

            "Country": "India",
            "Created_By": {
                "name": "Patricia Boyle",
                "id": "5725767000000411001",
                "email": "patriciaboyle@zoho.com",
            },
           .
           .
           .

            "Phone": "+9188255172**",
            .
            .
            .

        }
    ]
}

Alternatively, you can check the updated changes on the web UI.

Assignment Rules on records Upsert

Apply assignment rules during Upsert Records API.

Request URL : {api-domain}/crm/{version}/{module_api_name}/upsert
Request Method : POST

Sample Input

{
    "data": [
        {
            "First_Name":"James",
            "Description":"Checking Assignment rules",
            "Last_Name": "DJ",
            "Country": "Sri Lanka",
            "Company":"D Technology",
            "Email":"james@mail.com", //system-defined duplicate check field for Leads Module
            "Lead Source":"Cold Call",
            "Phone":"+9188255172",
            "Annual Revenue":"20000"
        }
    ],
    "lar_id": "5725767000000526437"
}

Note:
  • Provide the email (a system-defined mandatory field ) for the Leads module. If the record already exists, the system will check for matching data and update the record. If the record does not exist, a new record will be created.
  • Provide the assignment rule ID that you want to execute while upserting the record.
Sample Response

{
    "data": [
        {
            "code": "SUCCESS",
            "duplicate_field": "Email",
            "action": "insert", //No existing records were found. So, the system created a new record.
            "details": {
                "Modified_Time": "2023-05-31T12:02:32-07:00",
                "Modified_By": {
                    "name": "Patricia Boyle",
                    "id": "5725767000000411001"
                },
                "Created_Time": "2023-05-31T11:57:15-07:00",
                "id": "5725767000000627046", //ID of the record 
                "Created_By": {
                    "name": "Patricia Boyle",
                    "id": "5725767000000411001"
                }
            },
            "message": "record added",
            "status": "success"
        }
    ]
}

Thank you for your time, and we look forward to bring you another insightful guide in next week's Kaizen.
Feel free to post your queries in the comment section below or write to us at support@zohocrm.com 

Cheers!

Further Reading 









    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


                                              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