Function-16: Send automatic updates on deal progression by stage to all the Contact Roles

Function-16: Send automatic updates on deal progression by stage to all the Contact Roles



Welcome back everyone!

Last week, we learnt how to notify task owners when the ownership is changed. This week, let's look at a custom function lets you send automatic updates on deal progression by stage to all the Contact Roles

Business scenario:

The Deals module in Zoho CRM is designed to associate only one Contact per deal. Very often, B2B sales require touching upon multiple stakeholders, and the person you engage with need not be the decision maker. It is essential to keep track of all the contacts related to a deal. The Contact Roles field, listed under the Related List in deals module helps you do just that. It lets you profile multiple buyers associated with the deal based on their level of influence - Decision maker, Evaluator, Executive Sponsor, etc.

Part of the process while dealing with multiple buyers is sending updates on deal progression. The Executive Sponsor might be interested in the Price Quote. The evaluator might be interested to know whether deal is won. What if you want to update all the buyer profiles listed in the Contact Roles on deal progression. Getting all the email addresses from CRM and sending an email from your email client is indeed laborious. This week's custom function helps you automate this requirement by sending emails to all the related contacts about deal progress in a jiffy. However, as this custom function links to workflow with a canned message related to the deal status, it is required to replicate this multiple times based on the deal stages that require email notification. The required steps are detailed below:

Getting started with the custom function:
  • Go to Setup > Automation > Actions > Custom Functions > Configure Custom Function > Write your own.
  • Provide a name for the button. For example: “Send updates on deals to clients”. Add a description(optional).
  • Choose the module as "Deals".
  • Click “Free flow scripting”.
  • Copy the code given below.
  • Click “Edit arguments”.
  • Enter the name as “potId” and select the value as “Potential Id”.
  • Save the changes.
  • Click Save to create the button.

The script:

Code for Version 2.0 API:
 
relatedcontroles = zoho.crm.getRelatedRecords("Contact_Roles", "Deals", input.dealId.toLong());
//info relatedcontroles;
potIdStr=input.potId.toString();
potentialDetails = zoho.crm.getRecordById("Deals",input.dealId);
name=ifnull(potentialDetails.get("Deal_Name"),"");
closedate=ifnull(potentialDetails.get("Closing_Date"),"");
closetime=ifnull(potentialDetails.get("Closing _ime"),"5:00");
closelocation=ifnull(potentialDetails.get("Closing_Location"),"chennai");
for each role in relatedcontroles
{
emailAddress= role.get("Email");
info emailAddress;
str="<p>Hello all,<br /><br />Just wanted to make sure everyone hear the great news... the closing for " + name + " has been scheduled.<br />Date: " + closedate + " <br />Time: " + closetime + "<br />Location: " + closelocation + "<br /><br />Sincerely,<br />Gregory Pfeiffer .</p>";
sendmail
[
from:zoho.adminuserid
to:emailAddress
subject:"Closing Scheduled"
message:str
content type:HTML
]
}

Code for Version 1.0 API:

auth="xxxxxxxxxxxxxxxxxxxxx";
potIdStr=input.potId.toString();
potentialDetails = zoho.crm.getRecordById("Potentials",input.potId);
name=ifnull(potentialDetails.get("Potential Name"),"");
closedate=ifnull(potentialDetails.get("Closing Date"),"");
closetime=ifnull(potentialDetails.get("Closing Time"),"5:00");
closelocation=ifnull(potentialDetails.get("Closing Location"),"chennai");
test = getUrl((((("https://crm.zoho.com/crm/private/xml/ContactRoles/getRelatedRecords?authtoken=") + auth) + "&scope=crmapi&id=") + input.potId) + "&parentModule=Potentials",false);
info test;
data=test.get("responseText");
email = data.executeXPath("/response/result/ContactRoles/row/FL[@val = 'Email']/text()");
emailids=email.toList("-|-");
for each email in emailids
{
emailAddress=email;
info emailAddress;
str="<p>Hello all,<br /><br />Just wanted to make sure everyone hear the great news... the closing for " + name + " has been scheduled.<br />Date: " + closedate + " <br />Time: " + closetime + "<br />Location: " + closelocation + "<br /><br />Sincerely,<br />Gregory Pfeiffer .</p>";
sendmail
[
from:zoho.adminuserid
to:emailAddress
subject:"Closing Scheduled"
message:str
content type:HTML
]
}


Note:
  • The above code is written to update on closed deals. You may change the parameters 'closedate, closetime and closelocation', subject and the content of the email to customize it for other deal stages.
  • Change the 'xxxxxxxxxxxxxxxxxxxxx' in the authtoken with your own.

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

Do check out other custom functions shared in this series here.

See you all next week with another interesting custom function. Ciao!

Update: As you must be aware, API V1.0 will be deprecated and support for version 1.0 API will be available only till Dec 31, 2018. Version 1.0 compatible Functions will continue to work until Dec 31, 2019. You're advised to migrated to API Version 2.0 at the earliest. Check this announcement for more. We've updated the post to include the Version 2.0 compatible Function.

    Access your files securely from anywhere







                          Zoho Developer Community






                                                • Desk Community Learning Series


                                                • Digest


                                                • Functions


                                                • Meetups


                                                • Kbase


                                                • Resources


                                                • Glossary


                                                • Desk Marketplace


                                                • MVP Corner


                                                • Word of the Day


                                                • Ask the Experts



                                                          • Sticky Posts

                                                          • Zoho CRM Functions 53: Automatically name your Deals during lead conversion.

                                                            Welcome back everyone! Last week's function was about automatically updating the recent Event date in the Accounts module. This week, it's going to be about automatically giving a custom Deal name whenever a lead is converted. Business scenario Deals are the most important records in CRM. After successful prospecting, the sales cycle is followed by deal creation, follow-up, and its subsequent closure. Being a critical function of your sales cycle, it's good to follow certain best practices. One such
                                                          • User Tips: Auto-Create Opportunity/Deal upon Quote Save (PART 1)

                                                            Problem: We use quotes which convert to sales orders but Users / Sales Reps do not create opportunities / deals and go straight to creating a quote. This leads to poor reporting. Implementing this solution improves reporting and makes it easier for users.
                                                          • Custom Function : Automatically send the Quote to the related contact

                                                            Scenario: Automatically send the Quote to the related contact.  We create Quotes for customers regularly and when we want to send the quote to the customer, we have to send it manually. We can automate this, using Custom Functions. Based on a criteria, you can trigger a workflow rule and the custom function associated to the rule and automatically send the quote to customer through an email. Please note that the quote will be sent as an inline email content and not as a PDF attachment. Please follow
                                                          • Function #50: Schedule Calls to records

                                                            Welcome back everyone! Last week's function was about changing ownership of multiple records concurrently. This week, it's going to be about scheduling calls for records in various modules. Business scenario Calls are an integral part of most sales routines.. Sales, Management, Support, all the branches of the business structure would work in cohesion only through calls. You could say they are akin to engine oil, which is required by the engine to make all of it's components function perfectly. CRM
                                                          • Function #37: Create a Purchase Order from a Quote

                                                            Welcome back everyone! Last week, we learnt how to calculate the total number of activities for a lead and further take note of the activity count for particular dates. For instance, from the period of Demo to Negotiation. This week, let's look at a function that lets you create a Purchase Order instantly from a Quote. Business scenario: In any form of business, one of the most important things to do is to document the transactions. Naturally, negotiation, signing an agreement, placing an order,


                                                          Manage your brands on social media



                                                                Zoho TeamInbox Resources



                                                                    Zoho CRM Plus Resources

                                                                      Zoho Books Resources


                                                                        Zoho Subscriptions Resources

                                                                          Zoho Projects Resources


                                                                            Zoho Sprints Resources


                                                                              Qntrl Resources


                                                                                Zoho Creator Resources



                                                                                    Zoho CRM Resources

                                                                                    • CRM Community Learning Series

                                                                                      CRM Community Learning Series


                                                                                    • Kaizen

                                                                                      Kaizen

                                                                                    • Functions

                                                                                      Functions

                                                                                    • Meetups

                                                                                      Meetups

                                                                                    • Kbase

                                                                                      Kbase

                                                                                    • Resources

                                                                                      Resources

                                                                                    • Digest

                                                                                      Digest

                                                                                    • CRM Marketplace

                                                                                      CRM Marketplace

                                                                                    • MVP Corner

                                                                                      MVP Corner







                                                                                        Design. Discuss. Deliver.

                                                                                        Create visually engaging stories with Zoho Show.

                                                                                        Get Started Now


                                                                                          Zoho Show Resources


                                                                                            Zoho Writer Writer

                                                                                            Get Started. Write Away!

                                                                                            Writer is a powerful online word processor, designed for collaborative work.

                                                                                              Zoho CRM コンテンツ





                                                                                                Nederlandse Hulpbronnen


                                                                                                    ご検討中の方




                                                                                                          • Recent Topics

                                                                                                          • Zoho Writer - Option to Export as .zdoc format

                                                                                                            I've noticed that it's not possible to export a Zoho Writer Document in the .zdoc format. Isn't zdoc, Zoho Writer's own format? My use case is that I sometimes need to create quite complex documents with floating elements, which sometimes need to become
                                                                                                          • Is it possible for contacts to "Re-enter" a workflow in Zoho Campaign?

                                                                                                            We are currently working on a way to automatically add users to from one list to other lists based on specific criteria, but can't seem to find a native way of doing this so we are trying to use Workflows to do this. So, for example, if a user's status is set to "Active," then they should be added to the list "Active Users." If the same user's status is then set to "Paused," they should be added to the list "Paused Users" and removed from the list "Active Users." This works fine for the first go
                                                                                                          • Bulk upload images and specifications to products

                                                                                                            Hi, Many users have asked this over the years and I am also asking the same. Is there any way in which we can bulk upload product (variant) images and product specifications. The current way to upload/select image for every variant is too cumbersome.
                                                                                                          • Out of Office for Just One of My Alias Email

                                                                                                            Can I set up the Out of Office Reply for Just One of my Alias Email Addresses?
                                                                                                          • Can I map multiple Surveys into the CRM using the same fields?

                                                                                                            Hello, We are a healthcare practice that offers two distinct services (Nutrition and Primary Care). We use Zoho Survey for our lead generation form (Get Started Survey), which allows people to express interest in one of the two services and even allows
                                                                                                          • Dealing with API responses where integers have more than 16 digits

                                                                                                            Hi there How do I deal with an api response contaning an int or float with more than 16 digits (before any decimal places for a float). I constantly receive the response "Unable to cast the 'BigInteger' value into a 'BIGINT' value because the input is
                                                                                                          • To Zoho customers and partners: how do you use Linked Workspaces?

                                                                                                            Hello, I'm exploring how we can set up and use Linked Workspaces and would like to hear from customers and partners about your use cases and experience with them. I have a Zoho ticket open, because my workspace creation fails. In the meantime, how is
                                                                                                          • Can't change form's original name in URL

                                                                                                            Hi all, I have been duplicating + editing forms for jobs regarding the same department to maintain formatting + styling. The issue I've not run into is because I've duplicated it from an existing form, the URL doesn't seem to want to update with the new
                                                                                                          • Need Inactive accounts to be visible in Reports in Zoho Books

                                                                                                            I N=need Inactive accounts to be visible in Reports in Zoho Books to do recons of the accounts but when i see the same they are not visible in the Accountant - Account Transactions report
                                                                                                          • unblock e-mail

                                                                                                            please unblock my e-mails info@meatnews.gr and myrtokaterini@meatnews.gr
                                                                                                          • Add Zoho Mail for users who do not need Zoho One

                                                                                                            We have licenses for ZOho One for teams that need to use the suite of products that Zoho One offers.  We have 8 more people who only need email access and we would like to add just a Zoho Mail.  They do not need the Zoho One license.  We are currently
                                                                                                          • Zoho Projects - Q2 Updates | 2025

                                                                                                            Hello Users, With this year's second quarter behind us, Zoho Projects is marching towards expanding its usability with a user-centered, more collaborative, customizable, and automated attribute. But before we chart out plans for what’s next, it’s worth
                                                                                                          • ZML vs HTML Snippet - which is better?

                                                                                                            Are there certain use cases where one is better than the other?
                                                                                                          • Auto CheckOut Based On Shift.

                                                                                                            This Deluge script runs on a scheduled basis to automatically set the 'Actual_Check_Out' time for employees who haven't manually checked out. If the current time is past their scheduled 'Shift_End_Time', the script updates the check-out time to match
                                                                                                          • How to remove some users in zoho accounts

                                                                                                            How to remove some users in Zoho accounts.
                                                                                                          • Customizing Form Questions per Recipient Group in Zoho Campaigns/Forms

                                                                                                            Hello everyone, I would like to ask if it’s possible in Zoho Campaigns or Zoho Forms to send out a campaign where the form questions can be customized based on the group of recipients. Use case example: I have prepared 20 questionnaire questions. For
                                                                                                          • Infinite loop of account verification

                                                                                                            Hi I can't do anything on my zoho account.  I always get this message Hi Sheriffo Ceesay As a security measure, you need to link your phone number with this account and verify it to proceed further. When ever I supply the details, it displays that the number is associated with another account. I don't have any other account on zoho so this is really annoying. 
                                                                                                          • Load PO_Date field (Purchase Order) with current date in Deluge

                                                                                                            Hi, I'm not a full time developer, just helping to customize our CRM, in the small company I work for. There must be something wrong with me, because I can't do something so simple as complete a field with the current date in a function using Deluge.
                                                                                                          • Zoho CRM in Microsoft Power Automate Custom Connector

                                                                                                            Hi everyone, I’m building a Power Automate flow that integrates Microsoft Bookings with Zoho CRM. The goal is to automatically create a meeting (event) in Zoho CRM whenever a new appointment is booked via Microsoft Bookings. To achieve this, I created
                                                                                                          • Spell check sucks

                                                                                                            Come on guys, it's 2024 and your spell check is completely retarded. You gotta fix it.
                                                                                                          • How to include total km for multiple trips in expense report.

                                                                                                            Whenever I create a mileage report it only shows the total dollar amount to be reimbursed. The mileage for each individual trip is included but I also need to see the total distance for all trips in a report? How do I do this?
                                                                                                          • Outgoing blocked: Unusual activity detected.

                                                                                                            I just made payment for my Zohomail Today and have been debited so i will like to be Unblocked because this is what it says (Outgoing blocked: Unusual activity detected) Thank you i await your swift responses
                                                                                                          • Zoho One Login Issue - Unable to receive OTP

                                                                                                            Hi Support Team, I am experiencing a unique login issue with Zoho One. I am attempting to log in from India using Zoho Login credentials provided by a USA-based client. Their Zoho account is hosted on a US data center. After entering the username and
                                                                                                          • Question Regarding Managing Sale Items in Zoho Books

                                                                                                            Good day, I was wondering about something. Right now, Zoho Books doesn’t seem to have a way to flag certain items as being on sale. For example, if I want a list of specific items to be on sale from October 1 to October 12, the user would have to export
                                                                                                          • In the Zoho Creator Customer Payment form i Have customer field on select of the field Data want to fetch from the invoice from based on the customer name In the Customer Payment form i Have subf

                                                                                                            In the Zoho Creator Customer Payment form i Have customer field on select of the field Data want to fetch from the invoice from based on the customer name In the Customer Payment form i Have subform update Invoice , there i have date field,Invoice number
                                                                                                          • Problem of Import Client Users From CRM and or Expense

                                                                                                            I am premium plan user on Projects. I have about 500 customers on Expense and CRM that integrated with each other. According to at below link, I am trying to import clients from CRM, system not allowed to select any customer. If I import from Expense,
                                                                                                          • Unable to see free plan option

                                                                                                            Hello Zoho Support Team, I hope you are doing well. I am trying to sign up for Zoho Mail, but I am unable to see the option for the free plan. Could you please guide me on how I can access or activate the free plan? Thank you for your assistance.
                                                                                                          • unblock my zoho mail account. outlines@zoho.com

                                                                                                            please unblock my zoho mail account, outlines@zoho.com
                                                                                                          • domain not verified error

                                                                                                            Hi when i try to upload a video from zoho creator widget to zoho work drive iam getting domain not verified error.I don't know what to do .In zoho api console this is my home page url https://creatorapp.zoho.com/ and this is my redirect url:www.google.com.Iam
                                                                                                          • equest to Disassociate Bigin from Zoho One and Migrate to Standalone (Upgrade to Bigin Premier – 3 Seats, Annual)

                                                                                                            Dear Zoho One Support Team, I’m writing to request your assistance to disassociate (remove) the Bigin application from our Zoho One organization while preserving all existing Bigin data. After the disconnection is successfully completed, we intend to
                                                                                                          • SMTP email sending problem

                                                                                                            Hello, I've sent emails before, but you haven't responded. Please respond. My work is being disrupted. I can't send emails via SMTP. Initially, there were no problems, but now I'm constantly receiving 550 bounce errors. I can't use the service I paid
                                                                                                          • billing

                                                                                                            hi, I am being billed $12/year, and I can't remember why. My User ID is 691273115 Thanks for your help, --Kitty Pearl
                                                                                                          • How to add receipts

                                                                                                            How to add receipts
                                                                                                          • Unable to enable tax checkboxes

                                                                                                            Hi Zoho Commerce Support, I'm writing to report an issue I'm having with the tax settings in my Zoho Commerce store. I've created several tax rates under Settings > Taxes, but all of them appear with the checkbox disabled. When I try to enable a checkbox,
                                                                                                          • Does Zoho Learn integrate with Zoho Connect,People,Workdrive,Project,Desk?

                                                                                                            Can we propose Zoho LEarn as a centralised Knowledge Portal tool that can get synched with the other Zoho products and serve as a central Knowledge repository?
                                                                                                          • Zoho Commerce - Enable Company Name and Tax Number collection for B2B orders in Global Edition

                                                                                                            Please enable Company Name and Tax Details option on checkout settings in Zoho Commerce Global Edition. It is still important to collect Company Name and Tax Number for B2B sales in many countries. My business is based in Ireland (in the EU) and I have
                                                                                                          • ZohoSign and ZohoBooks Integration/Workflow

                                                                                                            Hello All, We utilize ZohoSign for signatures on tax eFiles. We utilize Dynamic KBA. Additionally, we use ZohoBooks for invoicing for these services. Is there a way to accomplish the following: Send a copy of the Tax Return, Invoice and eFiles in one
                                                                                                          • Manage monthly tasks with projectsf

                                                                                                            Hi All I run a finance and operations team where we need both teams to complete monthly tasks to ensure we hit our deadlines. Can Zoho projects be used for this. There many finance focused tools but we have Zoho one so want to explore Thanks Will
                                                                                                          • Zoho Suite is very slow

                                                                                                            Since today Zoho is incredibly slow over all applications! What's going on?
                                                                                                          • How can I track which zoho users are actively using Zoho CRM

                                                                                                            I have several licenses of Zoho CRM. We now need to add a new user. I could purchase a new license, but before I do, I would like to see if any of our existing users are not actively using the license assigned to them. How can I determine the activity
                                                                                                          • Next Page