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

    • 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,
      • Recent Topics

      • Incorrect Handling of XLSX data

        Trying to import an XLSX schedule of bills into Zoho Books I ran across the problem of date formatting. To replicate: Build a CSV file with bill dates in whatever format you like and import it - this should work if you match the "dd/MM/yyy" etc. format
      • Add Zoho Form Submission as Attachment to Zoho CRM Deal using Zoho Deal ID

        Hi Zoho team, I have a Zoho Form in which one of the fields will be hidden but will be defaulted with the Zoho Deal ID. Once the form is submitted, I want to reattach the submitted form (and another uploaded file field) into Zoho CRM Deals record. The crazy part is that Deal Name and Stage are the only two fields available for mapping. I have the actual Deal ID. Why can't I just use that. Can you please fix it so that I can properly attach the submission using Zoho Deal ID instead of name/stage (which
      • Workdrive on Android - Gallery Photo Backups

        Hello, Is there any way of backing up the photos on my android phone directly to a specific folder on Workdrive? Assuming i have the workdrive app installed on the phone in question. Emma
      • Displaying related quotes in sales order and back

        Hi, My colleague liked to see to which sales orders, the quote has been converted. Quote shows Invoices, but not SO. Same, they would like to see the quotes in the sales order, as they can see invoices, packages, shipment, How can we achieve this ? Thank
      • Payment link showing as malicious

        We've had a few customers who have been unable to pay invoices as the payment link (the domain is zohosecurepay.eu) is showing as a malicious website in their browser. Could anyone help with this please?
      • Side bar menu

        It would be great if you could stop the auto collapse of expanded menus when selecting a different module. It would save a lot of mouse clicks for a lot of users that frequently switch between sales & purchases as we do, it's easier to collapse them manually when not required !
      • Export Invoices to XML file

        Namaste! ZOHO suite of Apps is awesome and we as Partner, would like to use and implement the app´s from the Financial suite like ZOHO Invoice, but, in Portugal, we can only use certified Invoice Software and for this reason, we need to develop/customize on top of ZOHO Invoice to create an XML file with specific information and after this, go to the government and certified the software. As soon as we have for example, ZOHO CRM integrated with ZOHO Invoice up and running, our business opportunities
      • Multiple Respondents for One Survey Submission?

        Does anyone know of a way to allow multiple respondents to complete only one  survey and then also see (while completing the survey) the responses for their fellow colleagues who already answered that question? The situation is that our new customers have within their own organization, multiple employees that will need to assist in the one survey response. Since we don't always know which new respondent is the "who" that will have the answer, we need multiple respondents to be able to view the response
      • Can you remove the title from the forms?

        I am placing the iframes for my forms on my website.  Is it possible to remove or hide the title of the form so that it doesn't show up on the website? Is it possible to place text in the form like "clicking submit will take you to paypal." thanks
      • Zoho CRM's custom views are now deployable from sandboxes

        This feature is now available for users in the AU, JP, and CN DCs. Hello everyone, We're excited to announce that you can now deploy custom views from sandboxes to your production environment to ensure a smoother transition and save valuable setup time.
      • Create static subforms in Zoho CRM: streamline data entry with pre-defined values

        Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
      • Allowing vendors to Upload Purchase Invoices against Purchase Order

        Work Flow: Once Project is executed, We send Purchase order to every Vendors asking them to Share the invoice against the same. Most of the time Vendors Send invoices through Mails but our Finance Team miss to book those Purchase Invoices in Zoho Books.
      • Lost the ability to sort by ticket owner

        Hi all, in the last week or so, we have lost the ability to sort tickets by Ticket Owner. Unlike the other columns which we can hover over and click on to sort, Ticket Owner is no longer clickable. Is it just us, or are other customers seeing this too?
      • Edit Legend of Chart

        I would like to edit the legend of the chart. Every time I enable the legend, I get a very unhelpful (1), and when I try to type to change to what I would desire, nothing happens, which is very frustrating. I've gone through your online tutorials and nowhere can I find a legend settings button. This seems a simple fix, where can edit the legend? Thanks.
      • Mask Name Field in Report

        Is it possible to have the Name field as "Last Name, First Name" in a scheduled report.
      • Custom Project View by Project Group

        Hi Zoho Team, I used to have a custom project view which showed all my active projects (not cancelled or completed) and the list was separated into projects groups. Some time ago, possibly a couple of months ago, I began to see all projects even cancelled
      • Generate a link for Zoho Sign we can copy and use in a separate email

        Please consider adding functionality that would all a user to copy a reminder link so that we can include it in a personalized email instead of sending a Zoho reminder. Or, allow us to customize the reminder email. Use Case: We have clients we need to
      • Online Payment Fees

        We don't take many online credit card payments so the merchant service provider (PayPal) charges us the 2.9% fee for processing the amount. I would like the ability for the fee to be automatically added to the total amount for "ease of payment". We'd
      • Unable to attach the file via the API.

        We are trying to attach files to a Candidate in Zoho Recruit using the API. We reviewed the following API documentation: 🔗 Upload Attachment While this API does allow file attachment via a URL, that’s not what we want — we do not want to attach public-facing
      • Zoho Books (UK) needs to be able to submit a CT600 CTSA return

        As well as a VAT Return, most (if not all) small businesses have to submit a CT600 Corporation Tax Self-Assessment. There are many providers who do this (like Xero) bujt not Zoho. Can you add this to the request list please? Many thanks Steve
      • Stock Update After Approver 1 Approval in Multi-Level Approval Flow

        Hi Team, We have configured a multi-level approval process for POs/Bills. Our requirement is to update the item stock quantity based on the billed quantity immediately after Approver 1 approves the bill. Please find the script attached below. However,
      • Zoho Form Auto Fill

        I am setting up a Zoho form for my independent sales reps to request quotes. Their names are in the first field under a dropdown menu. The next field is their email address. I want the email address field to automatically be filled in when they select
      • Image Resolution Restriction Option in Zoho Forms File Upload

        Hi Zoho Forms Team, Greetings, We would like to request a feature enhancement for Zoho Forms regarding the file upload field. Currently, Zoho Forms allows us to restrict the file size of uploaded images, but not the image resolution (in megapixels). This
      • Allow selection of select inactive users in User data fields

        Hello, We sometimes need to select a previous employee that has an inactive account in the User data field. For example, when doing database cleanup and indicating actions are done by a certain employee that weren't filled out when they were part of the
      • Can't select Leave type while applying a leave

        Hello, while trying to apply a leave, I can't find any leave type among the options in the Leave type select: Here are my leave settings. Daily: Hourly: Tried to clear cache and to navigate from another browser, but the problem persists. Any hint? Thank
      • Entire notebook that had notes has disappeared

        I don't know how tf this happened. All I did was uninstall and reinstall the mobile app after fixing a bug I had. After I reinstalled the app, everything was synced back except for one folder which had a bunch of notes in it. None of those notes are in
      • Mes débuts sur Zoho Forms | 13 champs à l'export ! seulement

        Bonjour, je débute sur Zoho Forms, je viens de créer un formulaire avec tests dans la foulée et je n'ai que 13 champs qui remontent sur mon export CSV alors que j'ai plus de questions et champs qui devraient remonter. J'ai actuellement une formule payante
      • Introducing real-time document commenting and collaboration in Zoho Sign

        Hi, there! We are delighted to introduce Document commenting, a feature that helps you communicate with your recipients more efficiently for a streamlined document signing process. Some key benefits include: Collaborate with your recipients easily without
      • Zoho Payroll: Product Updates - July 2025

        Over the past month, we've focused on making Zoho Payroll more flexible, compliant, and easier to use—whether you're processing complex payouts, ensuring accurate calculations, or meeting local tax regulations. Here's what's new: One-Time Payments and
      • Adding Photos Into Form (as a form creator)

        As the form creator, is it possible to add images to my form? (I don’t mean adding an image upload field, but rather inserting a JPG file into the form so that users can view the image.)
      • [Training] AI-Powered Application Development Bootcamp 2.0 - Zoho Creator

        Hello everyone, Ready to take your app-building skills to the next level with the power of AI? We’re excited to invite you to AI-Powered Application Development Bootcamp 2.0—a 90-minute, live training session designed to help developers, business users,
      • automations: Can I execute a step on a specific date?

        I have created a form in Zoho forms, and created a contacts list. I have also begun setting up an automation with the intention of sending the form to the contact list on a specific date every month (via email) for the entire year (essentially sending
      • What is the easiest/fastest way to attach an email or PDF to a Zoho record?

        Hi everyone, We use Outlook with Office 365 and have the need to either ideally attach a .msg email directly to an account or custom module in Zoho, or if not attach just the PDF that would be sent in that email. The Zoho plugin is very basic for Outlook
      • Free webinar! Close deals faster with Zoho Sign from Zoho CRM

        Hello, Are you tired of chasing down signatures and getting stuck with paperwork delays in your sales process? With the seamless integration between Zoho Sign and Zoho CRM, you can create and send documents for signing online, close deals faster, and
      • Files stores in Library Marketing Automation

        Hi, How can i switch from card view to list view in Marketing Automation My Files.?
      • Paid for upgrade and no change

        I paid the $24.99 rate to upgrade to Pro version and no change when I signed out and signed back in.
      • Issue with Code Snippet Styling Overlap in Zoho Landing Page

        Dear Support Team, I have encountered an issue on the Zoho Landing Page while working with code snippets. When I try to create a custom script and add HTML, CSS, and JavaScript within the code snippet, the styling appears to overlap and affect other code
      • Adding yearly Calander

        How to add Yearly calander and employee data from admin console
      • Zoho Leave Policy > Portugal maternity Leave 120 days or 150 days

        Hello All In this Portugal maternity Leave policy, the government allow employee to apply 120 days they will have 100% paid salary if they apply 150 days they take 80% of the paid salary minimum 1 days and maximum 120 days or 150 days Should i setup this
      • Feature Request - Copy Reschedule Link

        Hi Bookings Team, I had a client contact me today, to let me know that she can't make a meeting she booked this week. I can't remember if I included a reschedule link in email notifications, but I was thinking that it would be great if I could just open
      • Next Page