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
    • 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,
    • Function-2: Round-Robin assignment of records

      Welcome back folks! Last week, we saw how to update sales commission in quotes using a custom function. This week, let's see an interesting use case asked by many of you - auto-assignment records by round-robin method. Business scenario: Right now, the solution allows you to auto-assign leads from web form and imported lists. Let us look at a need where you want to auto-assign leads from in-bound calls in a round-robin method, across modules. Prerequisite: You must create a permanent record in the
      • Recent Topics

      • Import template from Zoho Writer

        I am trying to import a mail merge template - tried to import direct from my .docx file on my hard drive and the formatting went all over the place. I then imported the .docx file in my Zoho Docs and then fixed up the formatting within Zoho Writer. Can
      • Which WhatsApp API works seamlessly with Zoho CRM?

        I’m exploring WhatsApp API solutions that integrate seamlessly with Zoho CRM for customer communication, lead nurturing, and automation. I would love to hear insights from those who have successfully implemented WhatsApp within Zoho CRM. My Requirements:
      • "Fail to update" error in Zoho Notebook

        I am getting a "fail to update" error repeatedly in Notebook when I try to update one of my existing notes with a screenshot.  Are there limitations on how large a note can be or what can be included in a file? 
      • Zeptomail 136.143.188.150 blocked by SpamCop

        Hi - it looks like this IP is being blocked, resulting in hard bounces unfortunately :( "Reason: uncategorized-bounceMessage: 5.7.1 Service unavailable; Client host [136.143.188.150] blocked using bl.spamcop.net; Blocked - see https://www.spamcop.net/bl.shtml?136.143.188.150
      • Multi-line address lines

        How can I enter and migrate the following 123 state street Suite 2 Into a contact address. For Salesforce imports, a CR between the information works. The ZOHO migration tool just ignores it. Plus, I can't seem to even enter it on the standard entry screen.
      • Weekly Tips: SecurePass For Extra Security

        Imagine sensitive data from your organisation sent via email is being accessed by unintended recipients. The sensitive data can range from Personal Identification Information to a tender quotation or a client’s NDA document. The unintended access could
      • Job Opening Fields - Rich Text

        I migrated to the new version (4?) of ZoHo Recruit.  I am trying to add a new field to my Job Openings layout and I want it to be a rich text field (just like the field I am typing in right now) so I can format the text, instead of just entering plain text.  I know the rich text field exists because one of my existing fields (Job Description) migrated over as a rich text field.  But I don't see rich text as a choice in the field type menu.  Or, I would like to change the field type on an existing
      • Cross-Posting to a Telegram Channel

        We don't have a native way to cross-post to Telegram channels. Did anyone find a way around it? I checked Zoho Flow - but Telegram isn't there. Maybe some 3rd party integrations connecting Facebook, IG, etc., bypassing SalesIQ altogether?
      • Deals sync for Campaigns or Marketing Automation...

        We are looking to create a marketing campaign based on a custom "expiration date" field inside our DEALS module. We are open to using either CAMPAIGNS or MARKETING AUTOMATION but haven't been able to get either platform to sync the specific fields we
      • Access of Activities Module in CRM to Client Portal?

        I want to enable access of Activities Module in Client Portal of my CRM to my Clients but not getting option to choose the module. By doing this I aim to give the access to the clients to their realtime status of the work going on and they can track the
      • Google ads - zoho crm integration problem

        dear zoho team we were starting to use google ads integration with zoho crm years ago.  but till April there was an error. we can see GCLID in zoho crm but we couldn't get any information from google ads. (keywords campaign name etc) is there any problem
      • User Filter for Dynamic Date Dimensions in Zoho Analytics

        One challenge I frequently encounter is the need to create multiple versions of the same report—one for yearly data, another for quarterly data, another for monthly, and so on. While this works, it leads to unnecessary duplication, making maintenance
      • Show or hide a field based on the value selected in another field?

        Can this be done in CRM? If not and can only happen in Creator is there a way to combine Creator and CRM without paying for 2 accounts?  Thanks in advance for your response(s).
      • WebDAV support

        I need WebDAV support so that I can upload/download (and modify) documents from my local file system. Is anything planned in his direction?
      • Is there a quick way to copy the contact details for a Zoho CRM contact?

        This has probably been asked lots of times before, but I couldn't find an answer anywhere - Is there a simple 'one-click' way to copy a contacts details from Zoho CRM, so that you can paste it into an email or word document? All I need is to grab 'business
      • Solution for setting up header and footer in a template

        Hi all, Emon need for business, I have long searched the forum and also how to put in my quote and my bills a header and a footer. And finally, I have an other working stream elements allowing me to meet my needs ... Given the number of people seeking the same thing as me, I say it might be good to share my discovery. It's simple and easy to implement First, start by adding the beginning of your HTML the following: <style> html {margin: 0;}  body {margin: 0;}  div # printhead { display: block;  position:
      • ZOHO Expense API Documentation - Can't see anything about Purchase Requests

        Hello, I am reading the API Documentation for Zoho Expense but can't see anything about Purchase Requests - This is one of the modules we use the most. Has anyone had any luck getting Purchase Requests data from Zoho Expense via API? Thanks,
      • KPI Widget - last month sales vs same period last year

        I would like a KPI Widget that might compare data with the following date ranges: This month to date (meaning all of February through the current date, for example the 14th, if today was the 14th. So Feb 1-14th 2018)vs. last year this month to date (Showing
      • Client Script event on any field of a Detail page

        Hi everyone! I'd like to trigger a Client Script when a user modifies a field - any field - from the Account Details page, how can I do this? I don't want to trigger it on a specific field, but on all of them. Thanks in advance!
      • GSTIN Public Search API

        Does zohobooks have an api using which i can search GST numbers and get their details?
      • Restrict Past Date in Zoho CRM Module

        How can I restrict from selecting a previous Date? I want only future dates to be selectable
      • Pushing GCLID info from Gravity Forms to ZohoCRM

        We are switching to Gravity Forms from Zoho Forms and I cannot find any good info on how to make sure my GCLID tracking info is pushed through to the CRM through my new forms. There was an article in the documentation about placing something within the
      • Add tasklist from a template to Zoho Project using Deluge

        I have some tasklist templates that I want to be able to add to a project under certain circumstances. So if a project meets Condition A, add the tasklist from Template B to that project. If it meets condition C, add tasklist from Template D, and so on.
      • 'Add Tax To Amount' not reflected in Invoice

        Hi Zoho Support, I'm experiencing an issue with tax calculation display in my invoice template. Despite having "Add tax to amount" box checked in the template settings, the Amount column is not showing the tax-inclusive total for line items. Current behaviour:
      • Enhancing self-service capabilities with AI-based Zia Answer Bot

        Hello All, Zia Answer Bot is available with better accuracy to enhance the self-service capabilities of the platform and to empower the users to resolve queries independently. By leveraging knowledge base (KB) resources, the Answer Bot provides accurate
      • Rounding off rate in quote

        Hi team, Please help me to rounding of rate amount in quote
      • Zoho Flow custom functions "Error occurred while processing this request. Contact support for more details"

        Any ideas why this is happening? Zoho Flow custom function...
      • Introducing our latest privacy enhancement - Hiding email IDs in Zoho Cliq Networks

        Hello everyone, Zoho Cliq Networks offers a powerful collaboration platform that allows businesses to create dedicated digital workspaces for external vendors, partners, or individuals you want to communicate with professionally without adding them to
      • I need to add difference for Average Row at the end

        (Confidential data hidden here) Guys, hello! I have this graph, it calculates the averages of Retention and then shows the delta (2024 - 2023). In the 3rd column with delta Churn %, I want to show the difference between averages too, which would be (16.99
      • No encuentro la opción para crear una orden de compra

        No encuentro la opción para crear una orden de compra, soy nuevo, ya busqué tutoriales, pero no me aparecen dichas opciones.
      • Post on behalf of employees as well as business socials

        Is there a way to give our sales team access to social to add their own LinkedIn accounts, so that when we schedule business posts, we can also post on behalf of them at the same time so they don't have to repost etc.
      • Alignment of Company Information Page Structure in Zoho One and Zoho Desk

        Hello Zoho One Support, We appreciate the continuous improvements across Zoho products. Recently, Zoho Desk restructured the Company Information page into three distinct sections: Company Profile – Includes Company Name, Logo, Alias, Description, Website,
      • Trying to setup a record to automatically create on a weekly basis

        Hello all, I need multiple records to be automatically created on a weekly basis. What I'm trying to accomplish is, I have a maintenance database where I track when I work on IT related systems. Every week on the same days I perform backups on systems
      • Effortlessly advance through your CRM blueprints by including optional fields in transitions

        Editions: Professional edition and above DCs: All Release plan: This enhancement is being released in a phased manner to customers. It will soon be available to all users. [Updated on 5 Sep 2024] This enhancement has been released to all users in all
      • How to merge duplicate products?

        merge duplicate products
      • How can I delete duplicate transactions?

        I want to delete the duplicates not simply exclude them. I have duplicates, because I had automatic bank feeds turned on (had to make sure this critical functionality was working before migrating to Zoho). Now when I import my csv's exported from Wave,
      • Automate posting to job site boards via Deluge/ or Schedule

        Hi Zoho Recruit Community, I'm working on automating a recurring job posting for a long-standing labor hire role that we update monthly. Right now, I can automate the creation of the job opening using scheduled tasks and Deluge scripts. However, the challenge
      • Customer Statement Template

        Hi. how can i add order number "customer LPO number" in the customer statement. regards
      • Is it possible to select the methods of inserting a signature (Not provider)

        Hi, I tried to search through the help pages and application interface trying to find if there's a way to limit the assigned signees, for example, allowing only images or drawing, and disallowing the automatic signature creator as per their name. It'll
      • How To Sync 'Deals' data To The Related Contact In The 'Contacts' Module

        Hi there! I'm looking to be able to sync Deals and Contacts. Basically, when someone places an order we have it syncing the order data to Deals, complete with the customer's name and email. Is there any way to have that Deal synced to the matching contact in the Contacts module? Presumably matching by email address. I'm familiar with Workflows, however it doesn't seem that Workflows work across different modules. We're looking to be able to run reports based on what the customer bought, but can't
      • Next Page