Sending Proposal to Customer as a attachment using Zoho CRM Inventory Template
Introduction: This guide explains how to send a proposal (quote) to a customer in Zoho CRM using a pre-defined inventory template and automation through a Deluge script.
Overview: The following code sends a quotation to a customer by generating a PDF from an inventory template and attaching it to an email. The quote and deal details are fetched from Zoho CRM, and the email is automatically generated and sent.
Deluge Script Code:
- // Inventory Template ID
- v_TemplateID = "6076403000000528121";
- // Quotation ID
- p_QuoteID = "60764030000005287854"
- //Deal Record ID
- record_id = "60764030000005287854"
- // get the quote details given a record ID
- r_QuoteDetails = zoho.crm.getRecordById("Quotes",p_QuoteID);
- v_Url = "https://zohoapis.com/crm/v2/settings/inventory_templates/" + v_TemplateID + "/actions/print_preview?record_id=" + p_QuoteID + "&print_type=pdf";
- f_FileRequest = invokeurl
- [
- url :v_Url
- type :GET
- connection:"arsh"
- ];
- info f_FileRequest;
- info "===============";
- f_FileRequest.setParamName("file");
- f_FileRequest.setFileName(r_QuoteDetails.get("Subject") + ".pdf");
- info f_FileRequest;
- // v_ContactName = contactData.get("Full_Name");
- EmailSubject = "Quote " + r_QuoteDetails.get("Subject");
- EmailMessage = "Dear " + v_ContactName + ",<br /><br />Attached is the quotation for your review.<br /><br />Best regards, <br /><br />Team StemRx";
- sendmail
- [
- from :zoho.loginuserid
- to :custEmail
- subject :EmailSubject
- message :EmailMessage
- Attachments :file:f_FileRequest
- ]
Conclusion:
This Deluge script automates the process of sending a proposal to customers from Zoho CRM by:
- Fetching the quote and template details
- Generating a PDF using an inventory template
- Sending the PDF to the customer via email
Notes:
- Ensure that you have the correct template ID (
v_TemplateID
). - Make sure that the contact's email address (
custEmail
) and deal ID (dealID
) are correctly fetched or provided. - The connection name
arsh
should be configured under Connections in Zoho CRM to make API calls.