Welcome back everyone!
Business scenario
We all have our own ways of categorizing stuff. Lets say, you have a bunch of novels and you categorize them based on the genre, like "Action & Adventure", "Fantasy" or "Thriller". All of them are placed under a "Book Shelf" with separate sections for each of the genre. In CRM parlance, "Book Shelf" is the "Module" and individual sections for each genre are the "Tags". Essentially, you can group together records from a specific CRM module and place them under tags.
Functions help you relate records across modules. How about using tags to associate record properties from other modules within a record? For instance, adding the Deal Stages like "Qualification", "Needs Analysis", "Proposal/Price Quote", "Negotiation/Review", "Closed Won", etc. as tags for associated Contact records. This week's Function helps you do just that.
As a result, if a Contact is associated with the deal, it is placed under the tag with the corresponding Deal Stage. Ex: if a deal associated with a Contact is in "Negotiation/Review" stage, the contact record is placed under the "Negotiation/Review" tag in the Contacts module. Include tags columns in the default/custom view of Contacts module to track the associated deal stage.
Pre-requisites
- Create Tags under the Contacts module with names from Deal Stages. Like "Qualification", etc.
Getting started with the function
- Go to Setup > Automation > Actions > Functions > Configure Function > Write your own.
- Provide a name for the function. For example: "Deal Stage as Tag in Contacts". Add a description (optional).
- Copy the code given below.
- Click “Edit arguments”.
- Enter the name as “contId” and select the value as "Contact Id".
- Click Save&Execute Script to check the code.
- Save the function.
The Code
-----------------------------------------------------------------------------------------------------------------------
headermap = Map();
headermap.put("Authorization","xxxxxxxxxxxxxxxx");
mp = Map();
mp.put("tag_names",input.stage);
response = invokeurl
[
type :POST
parameters:mp
headers:headermap
];
info response;
-----------------------------------------------------------------------------------------------------------------------
Note
- The code given above works only for V2 version of Zoho APIs. Please note that the code WILL NOT work for Version 1.0 APIs.
Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Do check out other functions shared in this series here.
See you all next week with another interesting function. Ciao!