Code Monkey home page Code Monkey logo

zoho-crm-trigger-workflow-assignment-rule-deluge's Introduction

Zoho-CRM-Trigger-Workflow-Assignment-Rule-Deluge

How to trigger workflow rules & assignment rules when Zoho CRM records are created, updated, or deleted via Deluge.

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 if you do not 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.

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":"[email protected]"};
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 use the following API call instead.

If you do not specify the trigger, it will automatically trigger workflows, blueprints and approvals.

  • If you do not wish to trigger, you need to enter the trigger value as [] (an empty list) in the trigger parameter.
    • It's important to switch off the trigger if your script is being triggered on Edit of any field to prevent a self-triggering loop from happening.
  • If you wish to only trigger the workflow, add "workflow" into the list for the trigger parameter like below.
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

Delete 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;

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

zoho-crm-trigger-workflow-assignment-rule-deluge's People

Contributors

jay-camber avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.