Organize Contacts based on the Deal Stages

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:

  1. Go to Setup > Developer Space > Functions > + Create New Function.
  2. Select Automation as Function type and click Next.
  3. Provide a name for the function. Add a description(optional).
  4. Copy the code given below.
  5. Click Edit Arguments.
  6. Enter the name as contId and select the type as Int.
  7. Click Save&Execute Script.
  8. Click Save.
 

The Code:


headermap = Map();
headermap.put("Authorization","xxxxxxxxxxxxxxxx");
mp = Map();
mp.put("tag_names",input.stage);
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v2/Contacts/" + contId + "/actions/add_tags?"
type :POST
parameters:mp
headers:headermap
];
info response;
 

Note:

  • The above code works only for API V2.0 and not the previous version.
 

Found this useful? Try it out and let us know how it works! If you have questions, do not hesitate to ask! Share this with your team if you find it useful!

Return to Tips