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

    • 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?
    • Round-Robin with Load Based Assignment, can you limit which Status are considered?

      Hello, We are currently using Round-Robin with Load Base Assignment. Is there a way to exclude tickets of a certain Status from being considered by the Round-Robin Assignment rules? For example... I have the following statuses. Escalation Review (meaning
    • How to link Custom Fields in Ticket view

      Hi team, I have created 2 custom fields in our Accounts Module would like them to show in our ticket information. We don't have Enterprise so I cannot do it via a workflow, but I know you can do lookup fields to link modules. How would I go about making
    • Notify on new comment

      I would like to notify users when a new comment is added to ticket/request? So if someone is following request they would get email or text saying that comment has been added to this request. Or request/ticket owner get notified. Thanks Luis
    • Stopped getting zoho notifications in Email for Customer response to support tickets

      Hello , I stopped receiving Notifications from customer response in my company with attached to this account.
    • Save Draft in email bigin for desktop and mobile

      Hi any news to when we going to have the save draft for email in bigin desktop and mobile?
    • Insufficient "previlleges" to perform this operation? All of a sudden

      Trying to create a ticket report in the free version of Zoho Desk (Analytics > tickets by contact), same as I have always done for the past 4 years every 2 weeks, and I am receiving the following message: I am labeled as Support Administrator, and we
    • Ticket sends email to 2 different email addresses

      Good afternoon, I am attempting to setup our ticketing system so that when a ticket is created, updated, and closed, it will email both the customer receiving support as well as the salesperson that is associated with the customer. The way that our tickets
    • API to post drafts for social media

      I we want to post draft posts to our zoho social account and then approve and schedule them within Zoho social. is this possible with for example: https://apis.zoho.com/social/v2/post TIA Jon
    • Forced Tooltip on Maps View

      Please remove the forced tool tip data points and ONLY include those listed in the "Include Columns for Tooltip" area. Also, disable the tool tip if no fields in there. With a lat/lng map, it forces showing those (and color field, lat count) and will
    • Anyone else having trouble with blurry pixelated screenshare?

      Ever since Monday Nov 26th., Cliq and Meeting screenshare has been blurry/pixelated like this:  https://www.screencast.com/t/0CblL3drKuU Did something change? Because Our Internet connects are plenty fast and everything is crystal clear in Skype... Also, video share is clear and normal, it is just screen share... Thanks
    • Map chart on Dashboard - can I disable tooltip?

      When adding a world map chart to a dashboard, I would like to disable the tooltip with details. Is there a way to do that?
    • ERROR

      I deleted a contact card, I want to add it again but it says that the contact already exists. I searched the records and it is not there, and I even deleted it in the trash. The email is this one: ldurbani@gmail.com. Please help!!
    • Currency Field Does Not show commas upon entry - leading to inaccurate entries!

      Hello Zoho... When our sales reps are entering deals and the profit/revenue it is difficult to accurately enter numbers with lots of zeros when there commas are NOT added until the record is saved. Could commas be added to this filed type as it is being
    • Display Profile Member Details of Logged In User in Zoho Site

      In a page, I want to display the profile details of the Member Portal who is logged in to my Zoho Site (email, name, etc.). How can I retrieve the email, name, and other data from the logged in user? I know that there is already a My Profile page that
    • Issues with Publishing Updates on Arabic Subsite in Zoho Site KSA

      Hello Zoho Community, I am reaching out to share my experience and seek assistance regarding an issue I’ve been facing with my Zoho Site KSA. Despite purchasing the Add-on Subsite twice, my subsite remains unpublished. Here are the details: Background:
    • Account name not populating when importing contacts

      When importing a csv file to add contacts the account name is blank? Every other filed gets mapped and imported correctly, i.e contact name, phone number. However not the account name which I have mapped to "company" field in my csv file
    • Support for Developing Zoho Recruit Extensions via Zoho Sigma

      Hi, I’m interested in building an extension for Zoho Recruit using Zoho Sigma. However, when I navigate to Sigma and attempt to create a new extension (via the "New Extension" option), Zoho Recruit does not appear as a listed service—only options like
    • Cannot use a Zoho Form in CRM Email Template

      I've created a Zoho form that has integration with Zoho CRM and is linked to a custom module. I know the form works as I have tested it. When I try and insert this Zoho Form in a button on a CRM email template set up with the same custom module I get
    • Zoho Desk using APIs

      We have generated the necessary tokens and successfully executed the following calls: • List all tickets • Get a ticket • Create a ticket We have encountered difficulties when attempting to perform searches using the APIs related to SEARCH, as it returns
    • Terms & Conditions Templates

      We are using Zoho books for more than 5 years now, We have different Products/Services which has different Terms & Conditions. I suggest to add the possibility to save Terms & Conditions text templates which we can choose during creating invoice or quote.
    • Zoho Recruit - Blueprint and ZIA

      If I activate the Blueprint for Jobs in Zoho Recruit, Zia disappears for matching canddiates, why is that?
    • Mapping for date field from one module to another.

      Hi there, I want to be able to map a date field(due date) in a module (sales order) to another module's(Purchase Requisition) date field(Promised customer date). Is this possible when the due date field is a zoho system date field while the promised customer
    • PDF API FROM ZOHO CREATOR DELUGE SCRIPT

      Hi I am in need of using a PDF Api to compress and Merge PDF files from zoho creator. Any support on this would be really helpfull any sample code for any PDF API would be extremely heplfull
    • Create deal from estimate

      Hello, I have integrated CRM and books. I created an estimate on CRM but I would like to allocate that estimate to a deal with the contact. How can I do this please?
    • Allow Selection of Multiple Threads and Notes for Splitting into a Separate Ticket

      Dear Zoho Team, We would like to request an enhancement to the Split as New Ticket feature within Zoho Desk. Currently, users can only select one incoming thread to split into a new ticket. However, there are many scenarios where the ability to select
    • Execution failure when fetching a Name field from another app

      In creator I have one app [Employee Directory] with a form [Employees]. One of the fields is a name field called [Name]. Here is a sample that works, if executed from the Employees app: test_Employee = Employees[Name.first_name == "Alex"]; info test_Employee.Name;
    • Auto-Create OneDrive Folder Structure Upon Lead Creation

      Hello, New to Zoho and looking for help on a critical process automation I'm looking to implement. My company currently utilizes OneDrive for file management and the folder structure is Proposals -> Client Name -> Address (where I need to initially create
    • Automatically add user on customer portal

      Hi Guys, I have a doubt about how to automatically add user details to the customer portal. Once the user details are submitted through the user form, those details should be automatically updated in the customer portal. how to do that any one have idea
    • Lookup field, odd issue

      So I tried creating and app that has the names of engineers so I can use that for a lookup in the other apps that are being created . I add the look up in a new app, launch the app and when I try to fill out the form its just blank in the drop down menu
    • Zoholics is weer terug in 2025! Save the date!

      Handen omhoog voor wie Zoholics vorig jaar heeft gemist! Wij ook! Als u nog nooit bij Zoholics bent geweest, leggen we het hier uit zodat u deze kans niet mist. We zijn blij u te kunnen vertellen dat de plannen voor de grote terugkeer van Zoholics in
    • ZOho Vault access denied

      Hello Community, I have suddenly got restricted by accessing Zoho vault . How can I get access back ?
    • Telephony External ID field added in CRM

      Dear All, We have an enhancement for users with telephony integrations—introducing the Telephony External ID field. Let's get into the details! What is an external ID field for telephony? External ID fields in Zoho CRM essentially hold a record's reference
    • Zoho Sheets working offline

      Hi,  I am looking for the ability to work offline in Zoho Sheets, but currently I cannot find the process to complete this.  Does someone have any ideas or steps I might have missed?  Also does Zoho Sheets have the "Format as Tables" function as is currently in MS Excel 2016??  Many thanks. 
    • Shared subfolders

      Am I right in thinking that there is no Zoho email application that allows me to create a shared inbox and then add additional folders/subfolders under that inbox? If so, this is really quite incredible and probably a deal breaker for us to start using
    • Incoming call logging in Bigin

      Request support on how can we log calls on bigin which are incoming. This is one of the very critical requirements for us
    • SMTP Authentication error with django backend

      Hello I have e zoho mail id info@mindbrewers.in But when i use it for smtp it gives 535 authentication error in django website . EMAIL_USE_SSL = False EMAIL_USE_TLS = True EMAIL_HOST = "smtp.zoho.com" EMAIL_PORT = 587 EMAIL_HOST_USER = "info@mindbrewers.in"
    • Important Update: Mandatory Email Domain Verification for Zoho Analytics Users

      To enhance the security and reliability of email notifications, we are implementing an important update. Starting February 1, 2025, verifying your email domain will be mandatory to continue sending email notifications via Zoho Analytics. Failure to verify
    • Custom Fonts in Zoho CRM Template Builder

      Hi, I am currently creating a new template for our quotes using the Zoho CRM template builder. However, I noticed that there is no option to add custom fonts to the template builder. It would greatly enhance the flexibility and branding capabilities if
    • Power of Automation :: Trigger Automatic reminders to the task owners five days before the due date.

      Hello Everyone, A Custom Function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as to when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
    • Next Page