Trigger Workflow and Assignment Rule via Deluge in Zoho CRM

Core Idea

When a Zoho CRM record is created / updated / deleted via Deluge, it does not trigger any associated workflow rule / assignment rule that you have set up in CRM unless you tell it to do so. This is in a way, more of a feature than a limitation as it offers developers more flexibility. This article demonstrates the different trigger parameters needed to perform these actions. If you like this, you should check out our other free Zoho training resources!

Tutorial

Create Records

For record creation, it’s rather easy and straightforward. If you’re using a Deluge task, all you need to do is to insert a {“trigger”:{“workflow”}} parameter after the create record map.
				
					
mp = {"Name":"Joe","Phone":"+1 678 XXX XXXX","Email":"joe@theworkflowacademy.com"};
response = zoho.crm.createRecord("Leads",mp,{"trigger":{"workflow"}});
				
			

Note: Change “Leads” and “mp” to the respective Module Name and map variable


To trigger assignment rules on record creation, first, you need to get the assignment rule ID (you can get it from the URL of the assignment rule), and put it in a map with “lar_id” as the key, and the assignment rule ID as the value. Then, insert it as a parameter at the end of your Deluge task.

  • If you wish to trigger the assignment rule alone:
				
					
response = zoho.crm.createRecord("Leads", mp, {"lar_id":"4409363000012741244"});
				
			
  • If you wish to trigger both workflow and assignment rule, add it inside the trigger workflow map, after the trigger workflow parameter:
				
					
response = zoho.crm.createRecord("Leads", mp, {"trigger":{"workflow"},"lar_id":"4409363000012741244"});
				
			
Note: Replace “4409363000012741244” with the respective assignment rule ID.

Update Records

Unfortunately, the {trigger”:{“workflow”}} parameter does not work for updates. To trigger workflows on record updates, you need to abandon Deluge task and use the following API call instead, with the exact parameters in this specific format.
				
					
datalist = List();
mp=Map();
mp.put("Lead_Status","Pre-Qualified"); //Insert your update map here
datalist.add(mp);
triglist = List();
triglist.add("workflow");
datamap = Map();
datamap.put("data",datalist);
datamap.put("trigger",triglist);
response = invokeurl
[
  url:"https://www.zohoapis.com/crm/v2/Leads/"+leadid
  type :PUT
  parameters:datamap.toString()
  connection:"crm_oauth_connection" 
];
info response;
				
			

Note: Change “Leads” and “leadid” to the respective Module Name and Record ID variable

Deleted Records

When deleting a record via the delete record API call, you need to add the wf_trigger=true parameter at the end of the URL.

				
					
response = invokeurl
[
	url: "https://www.zohoapis.com/crm/v2/Leads?ids=leadid&wf_trigger=true"
	type: DELETE
	connection:"crm_oauth_connection"
];
info response;
				
			

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page. And, if you want to know how CRM stacks up against its competitors, check out our detailed HubSpot and Zoho CRM comparison.

Contact Us!

Book a free 30-minutes consultation with a Zoho expert or send us an email

Related Resources