Kaizen #33 - Triggering Workflow Rules, Approvals, and Blueprints via Zoho CRM API

Kaizen #33 - Triggering Workflow Rules, Approvals, and Blueprints via Zoho CRM API

Hello everyone!

Welcome back to yet another post in the Kaizen series.
This week, we will discuss Triggering Workflow rules, Approvals, and Blueprints via Zoho CRM API, while inserting, updating, or upserting records.

First things first—What are Workflows, Approvals, and Blueprints?
  • Workflow Rules: Using workflow rules, you can automate a set of routine actions and communication like sending email notifications, assigning tasks, field updates, and so on.
  • Approvals: Using the approval process, you can automate the process of submitting records for approval based on certain conditions, and define the set of actions to be performed upon approval or rejection of the record.
  • Blueprints: Blueprints are a replica of your business process. They facilitate automation, validation, and collaboration of teams, thus making your business process more efficient and free from loopholes.
The default flow:
  1. While creating/updating/deleting records via API, you need not explicitly specify any input to trigger workflow rules, approvals, or blueprints. When the records match the criteria, the automation rules will be triggered automatically.
     
  2. When you specify an empty "trigger" array in the input, the system prevents the execution of all automation rules (workflow rules, approvals, and blueprints). 
    "trigger":[]
  3. To trigger a specific set of automation (workflow rule, approval or blueprint), you must specify the value in the "trigger" key of the input. For instance, to trigger all the workflow rules and approvals, but not blueprints associated with the request:
    "trigger": [
            "workflow",
            "approval"
        ]
Example:
Zylker Inc. is a sales organization that provides multiple B2B solutions. Let us see how Zylker Inc. manages various business scenarios using workflow rules, approvals, and blueprints.

1. Triggering workflow rules 
Assume that to avoid delayed closings, Zylker Inc., has decided to close deals with value 2000 or more, within a week of their initiation. 
To manage this, they have a workflow that automatically assigns a task to the deal owner to close the deal within a week, when a new deal with amount greater than or equal to 2000 is created. 
Here is a screenshot of a sample deal that meets the above mentioned condition, created via API.


You can see that a new task is automatically assigned to the deal owner to close the deal within a week. 


1a. To prevent the system from triggering workflow
Now, assume that a deal is already closed and won, and you are creating it in Zoho CRM for record purposes. In this case, there is no need to assign a task to the deal owner to close the deal within a week.
Hence, to prevent the system from triggering the workflow, you must specify the "trigger" key in the input with no values. The sample input would be:
{
    "data": [
        {
            "Deal_Name": "Sample Deal3",
            "Pipeline": "Standard",
            "Stage": "Qualification",
            "Amount": "6000"
        }
    ],
    "trigger": []
}

1b. To trigger all the workflow rules (but not approvals or blueprints)
To trigger all the workflow rules associated with creating a deal, and prevent the system from triggering any other automation rule (approvals or blueprints), the input would be:
{
    "data": [
        {
            "Deal_Name": "Sample Deal3",
            "Pipeline": "Standard",
            "Stage": "Qualification",
            "Amount": "6000"
        }
    ],
    "trigger": [
"workflow"
]
}

The "wf_trigger" parameter for Delete Records API
You can use "wf_trigger" parameter to trigger the workflows/prevent the system from triggering workflows while deleting records. The parameter accepts boolean values, with default value false. 

Sample request to trigger workflow while deleting records:
-X DELETE
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"

2. Triggering approvals
Assume that as per Zylker Inc's policies, the sales representatives are allowed to give a discount of up to only 10% during the negotiation stage of a deal. If they have to give a discount beyond 10%, they must get approval from their manager and their sales director. Based on the deal size and purchase history, the approvers would choose to approve or reject the discount requested by the customer. 
To manage this, they have configured an approval process that automatically submits the deals for approval, if the discount is more than 10%.
Here is a screenshot of a sample deal that meets the above mentioned condition, created via API.


You can see that the record has been automatically created in the approval mode.


2a. To prevent the system from triggering the approval process (while allowing it to trigger workflows)
While the above mentioned flow is default, there is a catch—when the deal amount is more than a specific limit, the restrictions on discount can be relaxed by sales representatives themselves. 
In this case, there is no need to submit the records for approval. However, the workflow rule must be triggered to create a task for the deal owner to close it within a week.
The sample input to trigger all the associated workflow but not approval processes would be:
{
    "data": [
        {
            "Deal_Name": "Sample Deal3",
            "Pipeline": "Standard",
            "Stage": "Qualification",
            "Amount": "6000"
        }
    ],
  
"trigger": [
        "workflow"
]
}

2b. To trigger all the approval process (but not workflows and blueprints)
To trigger all the approvals associated with creating a deal, and prevent the system from triggering any other automation rule (workflows or blueprints), the input would be:
{
    "data": [
        {
            "Deal_Name": "Sample Deal3",
            "Pipeline": "Standard",
            "Stage": "Qualification",
            "Amount": "6000"
        }
    ],
    "trigger": [
  "approval"
 ]
}
If you specify "approval" and "workflow" in the "trigger" array, the system triggers all the approval processes and workflow rules associated with the request.

3. Triggering a blueprint
Assume that Zylker Inc follows a simple deal follow-up process. Whenever a new deal is created, it goes through a few stages like Qualification, Negotiation, Discount Approval, Contract, and Deal Closure. To manage the same, they have configured a blueprint. 
In any case, if you do not want the record action to trigger the blueprint, the sample input would be: 
{
    "data": [
        {
            "Deal_Name": "Sample Deal3",
            "Pipeline": "Standard",
            "Stage": "Qualification",
            "Amount": "6000"
        }
    ],
    "trigger": []
}

If you specify an empty "trigger" array the system prevents the execution of any automation rule associated with the request. Instead, if you specify "blueprint" in the "trigger" array, all the blueprints associated with the request will be triggered by the system.

We hope you found this post useful. Reach out to us at support@zohocrm.com if you have any questions, or let us know in the comment section.

We will meet you next week with another useful topic.

Cheers!

Next 'Kaizen' - API Credits




          Zoho TeamInbox Resources

            Zoho DataPrep Resources


                Zoho CRM Plus Resources

                  Zoho Books Resources


                    Zoho Subscriptions Resources

                      Zoho Desk Resources

                        Zoho Projects Resources


                          Zoho Sprints Resources


                            Zoho Orchestly Resources


                              Zoho Creator Resources


                                Zoho WorkDrive Resources




                                    Zoho Campaigns Resources

                                      Zoho CRM Resources

                                                    Design. Discuss. Deliver.

                                                    Create visually engaging stories with Zoho Show.

                                                    Get Started Now


                                                      Zoho Show Resources


                                                        Zoho Writer Writer

                                                        Get Started. Write Away!

                                                        Writer is a powerful online word processor, designed for collaborative work.

                                                                  有料プランをご利用の方