Function #42: Organize Contacts based on the Deal Stages

Function #42: Organize Contacts based on the Deal Stages

Welcome back everyone!

Last week's function was about updating subform records in two accounts simultaneously whenever one of them is updated. This week, it's going to be about displaying the Deal stages as "tags" in the Contacts records.

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.


  • Create Tags under the Contacts module with names from Deal Stages. Like "Qualification", etc.

Getting started with the function

  1. Go to Setup > Automation > Actions > Functions > Configure Function > Write your own.
  2. Provide a name for the function. For example: "Deal Stage as Tag in Contacts". Add a description (optional).
  3. Copy the code given below.
  4. Click “Edit arguments”.
  5. Enter the name as “contId” and select the value as "Contact Id".
  6. Click Save&Execute Script to check the code.
  7. Save the function.

The Code


headermap = Map();
mp = Map();
response = invokeurl
url :"" + contId + "/actions/add_tags?"
type :POST
info response;



  • 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!

    Zoho Marketing Automation
              • Sticky Posts

              • Zoho User Group (ZUG) in-person Meetups

                Hello Zoho Community, We're pleased to announce the next leg of Zoho User Group in-person meetups. We're thankful for your overwhelming response to the meetups last quarter. Our teams had a blast meeting you all in person and finally being able to catch
              • Focus Group webinar - Revamped reports in Zoho CRM

                Any sales-based organization invests heavily in sales, which obviously translates to better revenue and overall growth. But how do we track how deals progress, or estimate how they will progress, or even how they performed? Blindly investing resources
              • Connect with Zoho users from your industry, virtually!

                A couple of years ago, we started setting up industry-wise channels for users with similar businesses to chat and discuss Zoho contextually. We started with Real Estate and E-commerce sectors, creating a chatroom and hosting regular meetups on niche areas
              • Tip #49: Associating Emails with Deals

                Hello folks,  Do you have multiple deals associated to your contacts in Zoho CRM? Are you struggling to find deal specific emails, with all the emails associated with a contact listed together? If yes, then this tip is totally for you!  You can associate emails with individual deals, rather than having them all listed under a contact. This helps you to access your deal based conversations more quickly and avoid looking through all your emails, searching for keywords and subject lines.  In Zoho CRM,
              • The role of a CRM admin and beyond | Small Business Heroes E10

                The tenth episode of Small Business Heroes, a CustomersSpeak series, features an interview with Troy Titus: a CRM administrator at Scale-Tec. Troy began his career by managing church activities and then moved on to gain real estate expertise by building

              Zoho Pagesense Resources

                Zoho SalesIQ Resources

                      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

                                      Qntrl 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