How to create workflow rules in Zoho CRM to perform mail merge tasks

How to create workflow rules in Zoho CRM to perform mail merge tasks

Overview

You can automate your Writer's mail merge tasks by creating Workflow rules in your Zoho CRM. Say, for example, you want to automate the merge and send task for every lead entry in your Zoho CRM account (merge every lead entry send an email notification to that lead automatically using workflow rules). The zoho.writer.mergeAndSend task will supply values to the merge fields inserted to a document, and send these merged documents individually to the email ID specified.

Info
You need a Zoho CRM account with manage workflow permission to create a workflow rule and associate it with a custom function.

Steps

Step 1: Create mail merge template in Zoho CRM

Before you get started, create a mail merge template with the required text and graphics. You can create mail merge templates in Zoho Writer and use CRM data (Leads, Accounts, Contacts, and Potentials) to create mail merge documents.
You can also create mail merge templates right inside Zoho CRM. Click here for detailed steps.

Step 2: Create a workflow in Zoho CRM

Workflow Rules in Zoho CRM, are a set of actions including email notifications, and field updates that are executed when specific conditions are met. You can create a workflow rule and set an action to automate Writer's Mail Merge Tasks. (Merge and email, merge and download, merge and store, merge and sign, merge and invoke)
Click here for detailed steps on how to create a workflow rule in Zoho CRM and associate custom function as an instant action.

Once you chose custom function as an instant action, do the following:
  1. You need to write a new custom function in the Deluge script editor and associate with the Workflow rule to automate Writer's mail merge tasks.
  2. Choose "Write your own" option from the Configure Function pop-up. 

  3. In the following Create new function pop-up, enter a function name, display name, and select the module to associate the custom function. Click Next. 
  4. Now start writing your custom function in the Deluge script editor. Click here to find the steps to programming custom functions in the Deluge script editor.

Step 3: Write your own custom function

You're creating a workflow rule to automate Writer's mail merge tasks including "Merge and Send", "Merge and Download", and "Merge and send for sign". Click here to know more about the available Writer tasks.

Merge and Send

Syntax
<response> = zoho.writer.v2.mergeAndSend(<document_id>, <merge_detail>, <output_settings>, <optional_settings>, <connection>);
Sample script
A sample script to Merge and send task is shown below:
Quote
// Fetch the CSV data from the web and store it in the variable - csv_content
 csv_content =  invokeurl 
 [
 type : GET
 ];
 
 
 // Construct a KEY-VALUE variable to hold the merge data and subject of the email
 merge_values = Map();
 merge_values.put("subject", "Merge and send Deluge task");
 merge_values.put("merge_data_csv_content", csv_content);
 
 
 // Perform the Merge and Send task 
 response = zoho.writer.mergeAndSend("al296XXXXXXXXXXXXXXXXXXXXXXXXXXXa516c", "inline", "shawn@zylker.com", merge_values, "writer_oauth_connection");

Example
Automatically generate a personalized quote with a CRM record's data and send it as an email. You can even perform multiple actions like storing the generated quote in your desired folder in Zoho WorkDrive and attaching the quote to the CRM record.

Merge and Store

Syntax
<response> = zoho.writer.v2.mergeAndStore(<document_id>, <merge_detail>, <output_settings>, <optional_settings>, <connection>);
Sample Script
A sample script to Merge and Store task is shown below:
Quote
document_id = "po5uobda049e029d4r98r84304jrj32";
                fields = Map(); 
                fields.put("ClientName", "Zylker");
                fields.put("ClientCompany", "Writer");
                fields.put("price", "10000");
                data_map = Map();
                data_map.put("data", fields);
                merge_details = Map();
                merge_details.put("merge_data", data_map);
                optional_settings= Map();
                output_settings = Map();
                output_settings.put("doc_name","SALES PROPOSAL");
                output_settings.put("folder_id","bsa6360a78f53f***");   //Workdrive Folder ID  //optional
                output_settings.put("output_format","pdf");    //docx|pdfform|pdf  //optional
                output_settings.put("password","*****");    //optional
                output_settings.put("overwrite_existing_file","true");    //true|false  //optional
                response = zoho.writer.v2.mergeAndStore(document_id, merge_details, output_settings, optional_settings, "writer_oauth_connection");
                info response;
Example
Generate invoices with a CRM record's data and store it in the desired folder in Zoho WorkDrive. You can even perform multiple actions like sending the invoice via email and marking the status in the CRM record.

Merge and Sign

Syntax
<response> = zoho.writer.mergeAndSign(<document_id>, <merge_detail>, <filename>, <signerList>, <option_settings>,  <connection>)
Sample Script
A sample script to perform the Merge and Sign task is shown below:
Quote
document_id = "po5uobda049e029d44b13a9956f6d2cedc67b"; 

fields = Map(); 
fields.put("InvoiceNo","12345"); 
fields.put("InvoiceDate","27 May 2022"); 
fields.put("InvoiceAmount","$100");
data_map = Map();
data_map.put("data", fields)
merge_details = Map();
merge_details.put("merge_data", data_map);

filename = "Invoice data";

signerList = List(); 
signerObj1 = Map(); 
signerObj1.put("recipient_1","john@zylker.com"); 
signerObj1.put("action_type","approve");  //approve|sign|view  
signerObj1.put("language","en"); 
signerObj2 = Map(); 
signerObj2.put("recipient_2","amelia@zylker.com"); 
signerObj2.put("action_type","sign");  //approve|sign|view  
signerObj2.put("language","fr"); 
signerList.add(signerObj1); 
signerList.add(signerObj2);


commonAttachmentFile1 = invokeurl 
[ 
type :GET 
]; 


option_settings = Map();

option_settings.put("sign_in_order","true");
option_settings.put("message", "Please find the document to be signed here");   
option_settings.put("set_expire", "30");
option_settings.put("reminder_period", "15");
option_settings.put("common_attachments", commonAttachmentFile1);
option_settings.put("test_mode", "true");

response = zoho.writer.mergeAndSign(document_id, merge_details, filename, signerList, option_settings, "writer_oauth_connection");

info response;
Example
Consider a scenario where a purchase order needs to be signed by multiple people. A sales rep can create a the purchase order with the CRM record's data and send it to sales managers for approval. You can also send the approved purchased order to the client via email.

Merge and Invoke

Syntax
<response> = zoho.writer.mergeAndInvoke(<document_id>, <merge_detail>, <optional_settings>, <connection>)
Sample Script
A sample script to perform the Merge and Invoke task is shown below:
Quote
document_id = "po5uobda049e029d44b13a9956f6d2cedc67b"; 

fields = Map(); 
fields.put("Name", "Ms.Amelia");
fields.put("Tamil", "S");
fields.put("English", "A");
fields.put("Maths", "A");
fields.put("Remark", "Good");
data_map = Map();
data_map.put("data", fields)
merge_details = Map();
merge_details.put("merge_data", data_map);

optional_settings= Map();
optional_settings.put("test_mode", "true");

response = zoho.writer.mergeAndInvoke(document_id, merge_details, optional_settings, "writer_oauth_connection");

info response;

Example
You can merge a deal agreement with your client's details from CRM and send it for signing. And once it is signed, you can invoke a custom function to save a copy of the agreement as an attachment to the CRM record.

        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          Access your files securely from anywhere

            Zoho CRM Training Programs

            Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

            Zoho CRM Training
              Redefine the way you work
              with Zoho Workplace

                Zoho DataPrep Personalized Demo

                If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

                Zoho CRM Training

                  Create, share, and deliver

                  beautiful slides from anywhere.

                  Get Started Now


                    Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                    BOOK A SESSION







                                Quick LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG

                                        Zoho FSM Video Tutorials


                                              All-in-one knowledge management and training platform for your employees and customers.

                                                        Create. Review. Publish.

                                                        Write, edit, collaborate on, and publish documents to different content management platforms.

                                                        Get Started Now




                                                                          You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                              Manage your brands on social media


                                                                                • Desk Community Learning Series


                                                                                • Digest


                                                                                • Functions


                                                                                • Meetups


                                                                                • Kbase


                                                                                • Resources


                                                                                • Glossary


                                                                                • Desk Marketplace


                                                                                • MVP Corner


                                                                                • Word of the Day


                                                                                • Ask the Experts


                                                                                  Zoho Sheet Resources

                                                                                   

                                                                                      Zoho Forms Resources


                                                                                        Secure your business
                                                                                        communication with Zoho Mail


                                                                                        Mail on the move with
                                                                                        Zoho Mail mobile application

                                                                                          Stay on top of your schedule
                                                                                          at all times


                                                                                          Carry your calendar with you
                                                                                          Anytime, anywhere




                                                                                                Zoho Sign Resources

                                                                                                  Sign, Paperless!

                                                                                                  Sign and send business documents on the go!

                                                                                                  Get Started Now




                                                                                                          Zoho TeamInbox Resources





                                                                                                                    Zoho DataPrep Demo

                                                                                                                    Get a personalized demo or POC

                                                                                                                    REGISTER NOW


                                                                                                                      Design. Discuss. Deliver.

                                                                                                                      Create visually engaging stories with Zoho Show.

                                                                                                                      Get Started Now








                                                                                                                                          • Related Articles

                                                                                                                                          • How to setup post merge operations on Zoho CRM's mail merge

                                                                                                                                            Overview Zoho Writer's mail merge templates provide custom functions to configure post-merge operations in Zoho CRM. You can perform operations such as attaching the merged document to a CRM record, creating or updating a CRM record with the filled ...
                                                                                                                                          • Getting started with document merge in Zoho Writer

                                                                                                                                            Overview Zoho Writer’s template-based document generation lets you automatically create personalized documents by merging pre-designed templates with data from spreadsheets, forms, CRMs, or APIs. Merge fields pull in real data to generate contracts, ...
                                                                                                                                          • Configure workflow in Zoho Books with Writer's mail merge

                                                                                                                                            Overview Use Zoho Writer with Zoho Books to create branded PDFs and automate document generation from your Books data. You can either use the Zoho Writer Templates extension in Zoho Books for one‑click document generation, or configure ...
                                                                                                                                          • Configure workflow in Zoho Projects with Writer's mail merge

                                                                                                                                            Zoho Writer and Zoho Projects' integration allows collaboration and document management for project teams. Project managers can automate the creation of critical documents using Zoho Writer's custom functions and workflow rules. The integration also ...
                                                                                                                                          • How mail merge template works in Zoho CRM

                                                                                                                                            Overview During CRM integration, when a user selects or opens any record and initiates a merge operation, a temporary document is generated from the chosen template to facilitate the merge operation with the record's data. It's crucial to note that ...
                                                                                                                                            Wherever you are is as good as
                                                                                                                                            your workplace

                                                                                                                                              Resources

                                                                                                                                              Videos

                                                                                                                                              Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                              eBooks

                                                                                                                                              Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                              Webinars

                                                                                                                                              Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                              CRM Tips

                                                                                                                                              Make the most of Zoho CRM with these useful tips.



                                                                                                                                                Zoho Show Resources