Custom Function : Automatically send the Quote to the related contact

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 these steps:

  1. Log in to Zoho CRM with administrative privileges.
  2. Click Setup > Automation > Workflow > Create Rule.
  3. In the New Rule page, choose Quotes module from the drop-down list and provide other rule details.
  4. Under Execute On, choose Create or Edit and then click Next.
  5. Specify the Rule Criteria. The rule will triggered only when a record meets the criteria mentioned here.
  6. In the Actions section, click on the Add button for Call Custom Functions.
  7. In the Configure Custom Function popup, click Write your own.
  8. Specify a name for the function.
  9. Build the Deluge Script based on the code given below.



void workflowspace1.Myfunction(string quoteId)
{
resp = zoho.crm.searchRecordsByPDC("Quotes","quoteid",input.quoteId);
respstr=resp.toString();
respmap=respstr.toMap();
productmap=respmap.get("product");
jlist=productmap.toJSONList();
ContactName=respmap.get("Contact Name");
AccountName=respmap.get(("Account Name"));
Description=ifnull(respmap.get("Description"),"");
AccountID=respmap.get("ACCOUNTID");
ContactID=respmap.get("CONTACTID");
accresp = zoho.crm.searchRecordsByPDC(("Accounts"),("accountid"),AccountID);
accrespstr=accresp.toString();
accrespmap=accrespstr.toMap();
conresp = zoho.crm.searchRecordsByPDC("Contacts","contactid",ContactID);
conrespstr=conresp.toString();
conrespmap=conrespstr.toMap();
Mobile=ifnull(conrespmap.get("Mobile"),"");
Email=ifnull(conrespmap.get("Email"),"");
City=ifnull(accrespmap.get("City"),"");
Street=ifnull(accrespmap.get("Street"),"");
str="<br><br><br><table border='0' cellspacing='0' cellpadding='0' width='100%' style='background:#fff;padding:2px;'><tbody><tr><td><table border='0' cellspacing='0'cellpadding='0' width='100%' style='border-left:1px solid #dadada;border-right:4px solid#dadada;border-top:1px solid #dadada;border-bottom:4px solid #dadada;padding:10px;background-color:white;'><tbody><tr><td valign='top'><div style='font-family:Arial, Helvetica, sans-serif; font-size: 13px;'><span style='font-family: Verdana, arial, Helvetica,sans-serif; font-size: 12px;'>Hello there!&nbsp;</span><div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'>Customer Name: ") + ContactName) + "&nbsp;</div><div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size:12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size:12px;'>Company Name: ") + AccountName) + "&nbsp;</div><div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'>Mobile Number: ") + Mobile) + "&nbsp;</div><divstyle='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=((str + " <div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'>Email Address:") + Email) + "&nbsp;</div><div style='font-family: Verdana, arial, Helvetica, sans-serif;font-size: 12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial, Helvetica, sans-serif;font-size: 12px;'>City:&nbsp;") + City) + "</div><div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'>Address:&nbsp;") + Street) + "</div><div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=((str + "<div style='font-family: Verdana, arial,Helvetica, sans-serif; font-size: 12px;'>Requirements :&nbsp;") + Description) + "</div><div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=str + " <div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'>Kindly allocate the partner for the above case and also update us on the further progress of the above lead.&nbsp;</div>";
str=str + "<div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size:12px;'>Regards, CNX Team</div><div style='font-family: Verdana, arial, Helvetica, sans-serif; font-size: 12px;'><br></div>";
str=str + "<table border='0' cellspacing='0'cellpadding='0' width='100%' style='font-family: Arial, Helvetica,sans-serif;font-size:11px;color:#000;'><thead><tr><td style='font-weight:bold;background-color:#eaeaea;border-top:2px solid gray;'>S.No.</td><td style='font-weight:bold;background-color:#eaeaea;border-top:2px solid gray;'>Product Details</td><td style='font-weight:bold;background-color:#eaeaea;border-top:2px solid gray;'>Qty</td><td align='right' style='font-weight:bold;background-color:#eaeaea;border-top:2px solid gray;'>List Price</td>  <td align='right' style='font-weight:bold;background-color:#eaeaea;border-top:2px solid gray;'>Total</td>  </tr> </thead>";
for each index j in jlist
{
mapvar=jlist.get(j);
finalMap=mapvar.toMap();
pdt=ifnull(finalMap.get("Product Name"),"");
qty=ifnull(finalMap.get("Quantity"),"");
listPrice=ifnull(finalMap.get("List Price"),"");
UnitPrice=ifnull(finalMap.get("Unit Price"),"");
TotalDis=ifnull(finalMap.get(("Total After Discount")),"");
qtyInStock=ifnull(finalMap.get("Quantity in Stock"),"");
Tax=ifnull(finalMap.get("Tax"),"");
netTotal=ifnull(finalMap.get("Net Total"),"");
discount=ifnull(finalMap.get(("Discount")),"");
Total=ifnull(finalMap.get("Total"),"");
str=str + "<tbody><tr><td style='border-bottom:2px dotted #dadada' valign='top'><b>" + (j  +  1) + "<br></b></td>";
str=str + "<td style='border-bottom:2px dotted #dadada'><b>" + pdt + "</b><br></td>";
str=str + "<td style='border-bottom:2px dotted #dadada' valign='top'>" + qty + "</td>";
str=str + "<td style='border-bottom:2px dotted #dadada' align='right' valign='top'>" + listPrice + "</td>";
str=str + "<td style='border-bottom:2px dotted #dadada' align='right' valign='top'>" + Total + "</td>";
str=str + "</tr></tbody>";
}
subtotal=ifnull(respmap.get("Sub Total"),"");
totaltax=ifnull(respmap.get("Tax"),"");
adjustment=ifnull(respmap.get("Adjustment"),"");
Grandtotal=ifnull(respmap.get("Grand Total"),"");
str=str + "<tbody><tr><td colspan='4' align='right'>Sub Total</td>";
str=str + "<td align='right'><b>" + subtotal + "</b></td></tr>";
str=str + "<tr><td colspan='4' align='right'>Tax</td>";
str=str + " <td align='right'>" + totaltax + "</td></tr>";
str=str + "<tr><td colspan='4' align='right'>Adjustment</td>";
str=str + "<td align='right'> " + adjustment + "</td></tr>";
str=str + "<tr><td colspan='4' style='border-bottom:2px solid #ccc' align='right'><b>Grand Total</b></td>";
str=str + "<td style='border-bottom:2px solid #ccc;border-top:2px solid #dadada;' align='right'><b>INR " + Grandtotal + "</b></td></tr></tbody></table><br><br></td></tr></tbody></table></td></tr></tbody></table>";
sendmail
[
from:zoho.adminuserid
to:Email
subject:"Quote Details"
message:str
content type:HTML
]
}

Note: This custom function is for the Quote module and you can modify it to send the automated email from the Sales Order and Invoices also. Also, we have used on the default Quote template model. If you want to change the quote layout, then you need to customize the custom function as per your requirement.

Please refer to the following link to know more about this feature:
    • Sticky Posts

    • Function #46: Auto-Calculate Sales Margin on a Quote

      Welcome back everyone! Last week's function was about displaying the discount amount in words. This week, it's going to be about automatically calculating the sales margin for a particular quote, sales order or an invoice. Business scenario Where there is sales, there's also evaluation and competition between sales reps. A healthy rivalry helps to better motivate your employees to do smart work and close deals faster and more efficiently. But how does a sales rep get evaluated? 90% of the time, it's
    • 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
      • Recent Topics

      • Bookings Notifications for Staff

        Good afternoon.  We are currently working on the trial version of Bookings as we review its usage for our client needs to schedule with specific team members.  We set everything up and it appears to be working, with the exception of sending an email to
      • Is COQL known to have read delays?

        Hello, I'm experiencing stale data returned by COQL from time to time. Most of the time it returns up-to-date data right after I update a record, but sometimes the change only shows up after several seconds or even minutes. Neither the COQL documentation
      • #18 Billing for the Hours, Not the Job

        A consultant in the comments last month put it plainly: her client pays by the hour and wants to see every hour on the invoice, including the dates. She was maintaining a spreadsheet and manually copying the totals into her invoices. If you bill by the
      • WhatsApp con bot en Make y derivación a una persona en Zoho CRM

        Estamos implementando en Zoho CRM un flujo de atención por WhatsApp con un bot en Make y una derivación a una persona. Necesitamos que cada mensaje quede registrado, que me avise cuando requiere atención y poder seguir la misma charla con el cliente.
      • Webhooks for Bigin

        Hello everyone, Say hello to webhooks in Bigin—a way to send information to other applications automatically the moment something happens to a record. Whether it's a deal moving stage, a contact being created, or a field changing, Bigin can now send an
      • Giving someone access to my FSM to develop + scope.

        Good evening, I’m new to Zoho, and had a CRM/Creator customized and it was missing something and not working. I realized it’s the functions and process and FSM was the missing link. I am trying to get FSM setup and all I have to do connect to CRM, Books,
      • Set Custom Icon for Custom Modules in new Zoho CRM UI

      • Reassign a team member's follow-up tasks without moving their customers | Kiosk Studio Session #13

        Hello folks, It's almost year-end, and a lot of people on your team will take time off. Their customers will still need things while they're away. Say Amanda is out next week (on leave). She has a renewal purchase order to chase for Grace, a quote Vikram
      • WorkDrive and CRM not in sync

        1/ There is a CRM file upload field with WorkDrive file set as the source: 2/ Then the file is renamed in WorkDrive (outside CRM): 3/ The File in CRM is not synced after the change in WorkDrive; the file name (reference) in CRM record is not updated (here
      • Short product videos on Zoho Commerce product pages: what works?

        Short product videos are becoming a normal part of online store pages, and I have been thinking about how to use them well on a Zoho Commerce store. A few points that seem to matter: Keep them short. 6 to 15 seconds showing the product from a few angles
      • Error AS101 when adding new email alias

        Hi, I am trying to add apple@(mydomain).com The error AS101 is shown while I try to add the alias.
      • Meet the new Zoho Analytics: The Agentic Analytics platform

        Every major release of Zoho Analytics has changed what you can do with data. This one changes who does the work. For years, analytics meant a chain of hands. The engineer shaped the data, the analyst wrote the query, the designer built the dashboard,
      • Function failure APIs report "no failures" (204 / empty 200) while the Failures view lists real failures

        We want to monitor custom-function failures through the API so we can find and re-run failed functions quickly. We could not find a function-failures endpoint in the API reference (only webhook failures are documented), so we tried the paths that exist
      • Zoho Writer workflows now support custom stages, parallel reviews, and external approvers

        Hello everyone, Zoho Writer now lets you build your own approval chains. The pre-built workflows also get new review modes, completion criteria, and external approver support. What’s new Custom workflows: Design review and approval processes from scratch,
      • Unlock more with Linkthread's new Basic plan

        Hey everyone, Last year, we introduced Linkthread by Zoho Social with a simple idea: help users bring everything they want to share into one link. Since then, Linkthread has continued to evolve, and we’re excited to announce its next milestone—the launch
      • Rating system button not translated to Spanish + "Done"

        I've run into a issue with the new system for rating support interactions when the chat is ended: Missing Spanish translation: The button is still showing in English as "Done," even though the interface language is set to Spanish. It should display something
      • 【11/19(木)15時〜・先着5名】後回しになっているZohoの設定、一緒に進めませんか?|オンラインもくもく会

        ユーザーの皆さま、こんにちは。 コミュニティグループの中野です。 「試したい機能や設定があるけれど、日々の業務で後回しになっている」 「一人で検証していると、途中で手が止まってしまう」 「ほかのユーザーがどう運用しているか、聞いてみたい」 そんな方に向けて、11月19日(木)にオンラインの「Zoho ワークアウト」を開催します。 参加者それぞれが取り組みたいテーマを持ち寄り、設定・検証・運用改善を進める少人数の「もくもく会」です。 各自で作業しながら、必要に応じてユーザー同士で相談や情報交換ができます。
      • Connection into Cliq?

        I have the SalesIQ chat widget on my site using the Zohobot but I'm not always on and my employees don't keep it open all the time. We do have Cliq open all the time though so I'd love a way to manage those discussions directly in Cliq as they come in.
      • Multiple Topics assigned to a single Campaign

        Hello, is it possible to assign multiple Topics to a single Campaign? We frequently write a content to our subscribers that spans multiple Topics and we would like to send it to all Contacts that are subscribed to at least one of the Topics. But it looks
      • How to sync Organisation Contacts to Android / AES

        After migration form Exchange compatible server, I got Org Contacts: I've turned on EAS Organisation contacts sync. But on my phone they don't appear and there is no contacts folder to select for these contacts. Only personal contacts. They do appear
      • Zoho Campaigns - Accept Rollup Summary As Format In Use

        Hi Zoho Team, I would like to request an enhancement to the integration between Zoho CRM and Zoho Campaigns. Currently, Rollup Summary fields in Zoho CRM are available for selection during field mapping, but I am unable to map a Rollup Summary field containing
      • Is it possible to change the percentage field in zoho crm , to put 3 decimals ?

        Hello , I need to write 1,444 in the percentage field in zoho CRM. However, I've noticed that there is a limitation of 2 decimals for this field. I've found out that if I replace this field with a Decimal one (.OO), I can choose to have 3 decimals. I've
      • Save hours daily this peak season: Better Inventory & Shipping with Zoho on Easyship

        Peak season shouldn't mean losing control of your inventory just to keep up with demand. When the holiday rush hits, everything in your business gets tested at once. Orders surge, stock runs low, and shipping costs climb as customers expect faster delivery
      • How Can Zoho Desk and Knowledge Base Help Manage Technical Support for an Android TV Website?

        Hello everyone, I manage MXL TV App, an independent technology website covering Android applications, Android TV, Smart TVs, digital entertainment, installation guides, and troubleshooting. I'm exploring ways to organize technical questions and make helpful
      • Build a Legacy of Support with Zoho Desk

        Hi everyone, World Heritage Day, also known by the name International Day for Monuments and Sites, is a moment to celebrate the stories, culture, and history preserved in the monuments, landscapes, and heritage around us. At Zoho Desk, heritage is not
      • Documents greater than 40MB Preview

        hello, Documents bigger than 40 MB cannot be previewed in WorkDrive Web App or Mobile App. would it be resolved in future?
      • Issues with Zoho Sheet in Mac

        I have downloaded the Zoho App from App Store but It is failing to Save As, Open & Download Operations. App Store
      • To-do lists screwed up by update

        My app just updated, and now it's unusable for my grocery and packing lists and pretty much everything I use this app for. It used to be that when you checked a box on a to-do list, the item was automatically migrated to the bottom of the list. Then when
      • Campaign send from unverified e-dress

        L.S. I have a problem with z-Campaigns. My email (sender) address seems to be unverified: Verified domain. Sender couldn’t be verified This email is from your organization’s verified domain, but the sender couldn’t be verified. It may be an automated
      • Change default "Sort by"

        Is there a way to change the default "sort by" when searching across modules?" in Zoho CRM? Currently the default sort method is "Modified time" but i would like to utilize the second option of "relevance" as the sort by default and not have to change
      • New Search Function

        Hey Team, The search function updated in our CRM about a week ago, so I assume it was an automated update across Zoho. It no longer displays leads/deals etc in Chronological order so that the most recently created or updated is the first to display which
      • Large List on Sub-Forms

        Hi, I would like to be able to add and use the Large List on a Sub-Form, currently it doesnt appear to show up for Sub-Forms. Thanks Dan
      • Feature Request: Post-commit Subform Row Event (onRowSave / afterRowCommit) in Client Scripts

        Hello Zoho CRM Product & Engineering Team, Requested Feature: Introduce an afterRowCommit (or post-commit onRowSave) subform event in Client Scripts that fires immediately after an inline subform row has been successfully committed to the database, passing
      • #CyberSecurityAwareness - Be diligent when it comes to Widget security

        We love Widgets in Zoho CRM! And in our experience they have become an essential tool for extending the feature set and providing a rich user experience beyond standard CRM UI, functionality and integrations. BUT BEWARE... If you are thinking of adding
      • Introducing the Zoho Campaigns MCP server

        Hello everyone, We are pleased to announce that Zoho Campaigns is now available in Zoho MCP. You can now connect your Zoho Campaigns organization to AI tools such as Claude, ChatGPT, GitHub Copilot in VS Code, and Cursor, and manage your email marketing
      • Deluge {"trigger":{"workflow"}} Do we need to add the id of rules of functions or rules in the workflow ?

        Hello , I've user {"trigger":{"workflow"}} in Deluge language. In my Deluge code, in order to trigger the workflow, I've specified the id of the workflow, of the rules and of the function called by the workflow. However, Zoho CRM told me that it was not
      • Let’s Talk Recruit: Answering your hiring review’s top five questions

        Picture this, it's the final week of the month, and your hiring review is just around the corner. You already know the questions you'll be asked. Which roles have been open the longest? Why did the Product Designer pipeline go quiet after the second interview?
      • What's New in Zoho POS - October 2026

        Hello everyone, Welcome to Zoho POS’s monthly update, where we bring you the latest feature releases, enhancements, events, and more. Let’s take a quick look at the new item price override option for embedded barcodes and how it can help streamline your
      • VENDORS ARE NOT SYNCHED WITH CONTACTS IN CRM

        Hello, While the ACCOUNTS and CONTACTS (Including the primary contact) are synced with the CONTACTS module in CRM, the vendor's CONTACTS are not synced with CRM - which basically forces the users to re-enter all vendor's contacts twice and then update
      • Hide Inactive Social Sign-In Providers from Login Screen

        Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
      • Next Page