Zoho CRM and Zoho Writer Merge and Send Function - Not Merging

Zoho CRM and Zoho Writer Merge and Send Function - Not Merging

Overall Problem
I needed a solution to automatically calculate and send employee payslip information stored on Zoho CRM, to each of our employees at the end of each month based on their salary, allowances and sales commissions (sales commissions - which may change each pay period based on deals completed)

Solution
I create a module on Zoho CRM called "Payslip Records", which contains records for each employee with their personal information, total sales commissions, allowances, net salary etc.

I then created a payslip template in Zoho Writer, and used the merge fields from the CRM "Payslips Module" to populate the fields on the payslip in Zoho Writer. If I run this manually from Zoho CRM, it works - the fields are merged and I can send the payslip to the employees via email.

Automating Challenge - Merge and Send Function in Zoho CRM not Merging Fields
So that the process could be automated with a workflow, I created a function which seems to be working - teh console log returns successful. However, when the function runs and the email is sent off I receive blank payslip templates in my inbox. Here's a look at my code below, can anyone explain why this might be happening that's wrong?

  1. payslipRecords = zoho.crm.getRecordById("Payslip_Records",payslipId,"crmwriter");
  2. fields = zoho.writer.getMergeFields("cpqhxd8f21b4c97794e3089ed074e21b45a51","crmwriter");
  3. info "fields : " + fields;
  4. info "payslipRecords : " + payslipRecords;
  5. data = Map();
  6. //data.put("First_Name", payslipRecords.get("Account_Name").get("name"));
  7. //data.put("Email", payslipRecords.get("Account_Name").get("id"));
  8. payslips = list();
  9. payslipfield = Map();
  10. payslipfield.put("Payslip_Records. Employee Name",ifnull(payslipRecords.get("Name"),""));
  11. payslipfield.put("Payslip Records. Department",ifnull(payslipRecords.get("Department"),""));
  12. payslipfield.put("Payslip Records. Pay Period",ifnull(payslipRecords.get("Pay_Period"),""));
  13. payslipfield.put("Payslip Records. Date of Payment",ifnull(payslipRecords.get("Date_of_Payment"),""));
  14. payslipfield.put("Payslip Records. Salary",ifnull(payslipRecords.get("Salary"),""));
  15. payslipfield.put("Payslip Records. Upfront Commissions",ifnull(payslipRecords.get("Upfront_Commissions"),""));
  16. payslipfield.put("Payslip Records. Recurring Commissions",ifnull(payslipRecords.get("Recurring_Commissions"),""));
  17. payslipfield.put("Payslip Records. Internet",ifnull(payslipRecords.get("Internet"),""));
  18. payslipfield.put("Payslip Records. Net Pay",ifnull(payslipRecords.get("Net_Pay"),""));
  19. payslips.add(payslipfield);
  20. data.put("Payslip_Records",payslips);
  21. mergedata = Map();
  22. mergedata.put("merge_data",{"data":data});
  23. mergedata.put("subject","Payslip Due");
  24. //optionalDF
  25. mergedata.put("message","Please find your payslip attached.");
  26. info "mergedata : " + mergedata;
  27. update = zoho.writer.mergeAndSend("cpqhxd8f21b4c97794e3089ed074e21b45a51","pdf",payslipRecords.get("Email"),mergedata,"crmwriter");
  28. info "update : " + update;

Console Information
  1. Info
    • fields : {"rl_fields":[],"fields":["Employee_Name"]}
    • payslipRecords : {"Salary":1000,"Owner":{"name":"John Doe","id":"4035844000008772172","email":"john@email.com"},"Email":"john@email.com","$currency_symbol":"Bds$","Net_Pay":1260.45,"$review_process":{"approve":false,"reject":false,"resubmit":false},"Name":"John Doe","Last_Activity_Time":null,"Record_Image":null,"Modified_By":{"name":"John Doe","id":"4035844000008772172","email":"john@email.com"},"Department":"Operations","$review":null,"$state":"save","Unsubscribed_Mode":null,"$process_flow":false,"Exchange_Rate":1,"Currency":"BBD","id":"4035844000024583003","$approved":true,"Recurring_Commissions":10.45,"$approval":{"delegate":false,"approve":false,"reject":false,"resubmit":false},"Modified_Time":"2021-02-23T10:20:21-04:00","Created_Time":"2021-02-23T10:20:21-04:00","Unsubscribed_Time":null,"$editable":true,"Date_of_Payment":"2021-02-28","$orchestration":false,"$in_merge":false,"Tag":[],"Internet":50,"Upfront_Commissions":200,"$approval_state":"approved","Pay_Period":"2021-02-15"}
    • mergedata : {"merge_data":{"data":{"Payslip_Records":[{"Payslip_Records. Employee Name":"John Doe","Payslip Records. Department":"Operations","Payslip Records. Pay Period":"2021-02-15","Payslip Records. Date of Payment":"2021-02-28","Payslip Records. Salary":1000,"Payslip Records. Upfront Commissions":200,"Payslip Records. Recurring Commissions":10.45,"Payslip Records. Internet":50,"Payslip Records. Net Pay":1260.45}]}},"subject":"Payslip Due","message":"Please find your payslip attached."}
    • update : {"merge_report_data_url":"https://docs.zoho.com/writer/api/v1/merge/job/aa5fea7ce716f6854f78ce450bf8333c67f0dd47c7f5a6b3f6fe5644fe18afcc/data","merge_report_url":"https://docs.zoho.com/writer/v1/mailmerge/job/aa5fea7ce716f6854f78ce450bf8333c67f0dd47c7f5a6b3f6fe5644fe18afcc","records":[{"download_link":"https://docs.zoho.com/writer/api/v1/merge/job/aa5fea7ce716f6854f78ce450bf8333c67f0dd47c7f5a6b3f6fe5644fe18afcc/record/aa5fea7ce716f6854f78ce450bf8333c9587b8912fcf060c77d27971ad2eecd9/attachment/1/download","SEQUENCE":1,"Payslip_Records":[{"Payslip Records. Net Pay":1260.45,"Payslip Records. Recurring Commissions":10.45,"Payslip Records. Department":"Operations","Payslip_Records. Employee Name":"John Doe","Payslip Records. Internet":50,"Payslip Records. Pay Period":"2021-02-15","Payslip Records. Date of Payment":"2021-02-28","Payslip Records. Upfront Commissions":200,"Payslip Records. Salary":1000}],"id":"758541b4-e20f-4275-a434-fe32553c3b65","status":"inprogress"}]}
    Function executed successfully

Please help if you can, thanks! I've attached images of the merge template with the field ID's in Zoho Writer for reference.



      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Sticky Posts

          • Deprecation of certain URL patterns for published Zoho Writer documents

            Hi Zoho Writer users! We'd like to let you know that we have deprecated certain URL patterns for published and embedded documents in Zoho Writer due to security reasons. If the published or embedded documents are in any of these URL patterns, then their
          • [Announcement] Insert image from URL changes in Zoho Writer

            Hi Zoho Writer users! We'd like to let you know that we've changed the behavior of the Insert image from URL option in Zoho Writer for security reasons. Earlier behavior Once you inserted an image URL in a Writer document, the image would be fetched from
          • Introducing plagiarism checker in Zoho Writer

            Zia, Zoho Writer's AI-driven writing assistant, now highlights plagiarized and duplicated content in addition to offering contextual grammar and writing suggestions to help you write clearly and concisely in English. Zoho Writer's plagiarism reports Here
          • [Important announcement] Impact of Google's new email guidelines for Zoho Writer automation users

            Hi users, Google has recently announced new guidelines for sending emails to Gmail and other Google-hosted domains. These guidelines will be effective starting Feb. 1, 2024, and can impact the delivery of emails sent from Zoho Writer. Your organization
          • Transitioning from MS Word to Writer: A complete walkthrough

            Hello everyone! We understand moving to a new word processing tool can be difficult, especially if it means switching from a legacy software like MS Word. That's why we've organized an exclusive webinar where we talk you through ways to make your switch from MS Word to Writer as easy as possible. In this webinar, you'll learn: - Why Writer is a simple yet powerful alternative to MS Word. - How to locate your favorite MS Word features and functions in Writer.  - How to migrate your Word documents

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ






                                ご検討中の方

                                  • Recent Topics

                                  • When moments in customer support get "spooky"

                                    It’s Halloween again! Halloween is celebrated with spooky symbols and meanings based on history and traditions, with each region adding its own special touch. While we were kids, we would dress up in costumes along with friends, attend parties, and enjoy
                                  • How Zoho Desk contributes to the art of savings

                                    Remember the first time your grandmother gave you cash for a birthday or New Year's gift, Christmas gift, or any special day? You probably tucked that money safely into a piggy bank, waiting for the day you could buy something precious or something you
                                  • Empowered Custom Views: Cross-Module Criteria Now Supported in Zoho CRM

                                    Hello everyone, We’re excited to introduce cross-module criteria support in custom views! Custom views provide personalized perspectives on your data and that you can save for future use. You can share these views with all users or specific individuals
                                  • 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,
                                  • Automatically Add Recurring Zoho Meeting Events to Zoho Calendar / Zoho Meeting Calendar

                                    Hello Zoho Meeting Team, Hope you are doing well. We would like to request an enhancement regarding recurring meetings created inside Zoho Meeting. At the moment, when we schedule a recurring meeting in Zoho Meeting, it does not appear in Zoho Calendar
                                  • Limited layout rules in a module

                                    There is a limit of 10 layout rules per module. Is there a way to get that functionality through different customization or workflow + custom function (easily accessible), etc. Having just 10 is limiting especially if module contains a lot of data. Are
                                  • Enhance Sign CRM integration

                                    Hello all, I'm working on a custom Deluge script to enhance the integration between Zoho CRM and Sign by using a writer merge template for additional flexibility. I want to replicate the post-sign document integration that exists between CRM and Sign
                                  • Python - code studio

                                    Hi, I see the code studio is "coming soon". We have some files that will require some more complex transformation, is this feature far off? It appears to have been released in Zoho Analytics already
                                  • Good news! Calendar in Zoho CRM gets a face lift

                                    Dear Customers, We are delighted to unveil the revamped calendar UI in Zoho CRM. With a complete visual overhaul aligned with CRM for Everyone, the calendar now offers a more intuitive and flexible scheduling experience. What’s new? Distinguish activities
                                  • Replacing email ID,

                                    In zoho sheets If I am sending it as an email attachments can I replace sender email ID from notifications to my email ID.
                                  • Move orders scan ISBN

                                    Hi We have ISBN setup to be searched in items zoho but move orders dissent recognize the ISBN is there q missing configuration? regards, JS
                                  • ViewID and Zoho Desk API

                                    I'm looking at the documentation for Listing contacts and it looks like you can filter by ViewID. I assume this is views created in a department or all departments. Is this correct? And if so, how do I find the ViewID for that view? EDIT: I see the view
                                  • Ability to Link Reported Issues from Zoho Desk to Specific Tasks or Subtasks in Zoho Projects

                                    Hi Zoho Desk Team, Hope you're doing well. When reporting a bug from Zoho Desk to Zoho Projects, we’ve noticed that it’s currently not possible to select an existing task or subtask to associate the issue with. However, when working directly inside Zoho
                                  • Automatically Update Ticket Status in Zoho Desk Based on Actions in Zoho Projects

                                    Hi Zoho Desk Team, Hope you’re doing well. We’re using the Zoho Desk–Zoho Projects integration to manage tasks related to customer tickets, and it works well for linking and tracking progress. However, there are a few important automation capabilities
                                  • Print Tickets

                                    We have field engineers who visit customers. We would like the option to print a job sheet with full details of the job and account/contact details.
                                  • Zoho Desk integration with Power BI

                                    Hi, I want to be able to create a Power BI report which has live updates of ticket data from zoho desk, is this possile at all? Thanks Jack
                                  • Ability to Attach Images When Reporting Issues to Zoho Projects from Zoho Desk

                                    Hi Zoho Desk Team, Hope you’re doing well. We’re using the Zoho Desk–Zoho Projects integration to report bugs directly from support tickets into the Zoho Projects issue tracker. This integration is extremely useful and helps us maintain smooth coordination
                                  • Ability to Choose Task List and Add Subtasks When Creating Tasks from Zoho Desk

                                    Hi Zoho Desk Team, Hope you’re doing well. We’re using the Zoho Desk–Zoho Projects integration to seamlessly connect customer tickets with project tasks. While the integration works great overall, we noticed two important limitations that affect our workflow
                                  • Sync Task Status from Zoho Projects to Zoho Desk

                                    Hi Zoho Desk Team, Hope you’re doing well. We’re actively using the Zoho Desk–Zoho Projects integration, which helps our support and project teams stay aligned. However, we noticed that when we change a task’s status in Zoho Projects, the change is not
                                  • Default/Private Departments in Zoho Desk

                                    1) How does one configure a department to be private? 2) Also, how does one change the default department? 1) On the list of my company's Zoho Departments, I see that we have a default department, but I am unable to choose which department should be default. 2) From the Zoho documentation I see that in order to create a private department, one should uncheck "Display in customer portal" on the Add Department screen. However, is there a way to change this setting after the department has been created?
                                  • Retainer invoice in Zoho Finance modlue

                                    Hello, Is there a way of creating retainer invoices in the Zoho Finance module? If not can I request this is considered for future updates please.
                                  • Can we do Image swatches for color variants?

                                    We want to do something like the attached screenshot on our new zoho store. We need image swatches instead of normal text selection. We want to user to select an image as color option. Is this doable? I don't see any option on zoho backend. Please h
                                  • Zoho CRM IP Addresses to Whitelist

                                    We were told to whitelist IP addresses from Zoho CRM.  (CRM, not Zoho Mail.) What is the current list of IP Addresses to whitelist for outbound mail? Is there a website where these IP addresses are published and updated?  Everything I could find is over
                                  • Color of Text Box Changes

                                    Sometimes I find the color of text boxes changed to a different color. This seems to happen when I reopen the same slide deck later. In the image that I am attaching, you see that the colors of the whole "virus," the "irology" part of "virology," and
                                  • The difference between Zoho Marketing Automation and Zoho Campaigns

                                    Greetings Marketers! This post aims to differentiate between Zoho Marketing Automation and Zoho Campaigns. By the time you get to the end of the post, you will be able to choose a product that objectively suits you. What is Zoho Marketing Automation?
                                  • How to use Rollup Summary in a Formula Field?

                                    I created a Rollup Summary (Decimal) field in my module, and it shows values correctly. When I try to reference it in a Formula Field (e.g. ${Deals.Partners_Requested} - ${Deals.Partners_Paid}), I get the error that the field can’t be found. Is it possible
                                  • Zoho Mail Android app update - View emails shared via Permalink on the app.

                                    Hello everyone! In the latest version(v2.8.2) of the Zoho Mail Android app update, we have brought in support to access the emails shared via permalink within the app. Earlier, when you click the permalink of an email, you'll be redirected to a mobile
                                  • Let us view and export the full price books data from CRM

                                    I quote out of CRM, some of my clients have specialised pricing for specific products - therefore we use Price Books to manage these special prices. I can only see the breakdown of the products listed in the price book and the specialised pricing for
                                  • Weekly Tips: Manage External Images in Zoho Mail

                                    When you receive emails every day, whether from clients, newsletters, or services, many of them contain external images that automatically load when you open the message. While this can make emails look more engaging, it can also impact your privacy and
                                  • How to display Motivator components in Zoho CRM home page ?

                                    Hello, I created KPI's, games and so but I want to be able to see my KPI's and my tasks at the same time. Is this possible to display Motivator components in Zoho CRM home page ? Has someone any idea ? Thanks for your help.
                                  • Introducing Record Summary: smarter insights at your fingertips

                                    Hello everyone, We’re excited to introduce the Record Summary feature. This powerful addition makes use of Zia to simplify how you interact with your CRM data, providing a seamless, consolidated view of critical record information. Scrolling through the
                                  • Account in Quick View Filter

                                    I have a report that I often run against a specific Account. Every time, I have to go into the edit menu and change the Advanced Filter. I would prefer to use the Quick View Filter, but it does not allow me to use the one and only field that makes any
                                  • Insert Cookie Policy in Zoho Sites

                                    Hello, i need to insert a banner on my site because i'm in Italy so i have to respect EU laws for Cookie Policy and Privacy Policy. I see that i need to insert a code in <head> section of my site to show a banner/popup with cookie info. How i can do this? Thank you Luca
                                  • Cliq iOS can't see shared screen

                                    Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
                                  • Unable to confirm Super Admin assignment — confirmation button not working

                                    I’m trying to change the roles within my organization. I am currently a super admin and would like to add another user as a super admin. When I attempt to confirm the action, a screen appears asking for my password to verify my identity. However, when
                                  • Delegates should be able to delete expenses

                                    I understand the data integrity of this request. It would be nice if there was a toggle switch in the Policy setting that would allow a delegate to delete expenses from their managers account. Some managers here never touch their expense reports, and
                                  • Let's Talk Recruit: Meet Zia, your all-in-one AI assistant (Part-2)

                                    Welcome back to Let’s Talk Recruit series. In Part 1, we introduced Zia and how AI is reshaping the way recruiters work. This time, we’re taking a closer look at how far Zia has come and how each update continues to simplify your everyday tasks. When
                                  • Function #9: Copy attachments of Sales Order to Purchase Order on conversion

                                    This week, we have written a custom function that automatically copies the attachments uploaded for a sales order to the corresponding purchase order after you convert it. Here's how to configure it in your Zoho Books organization. Custom Function: Hit
                                  • stock

                                    bom/bse : stock details or price =STOCK(C14;"price") not showing issue is #N/A! kindly resolve this problem
                                  • Kaizen #8 - Handling Recurrence and Participants in the Events Module via API

                                    Hello everyone! We are back this week with an exciting post—Handling recurrence and participants in the Events module through API. First things first—What is the Events module? "Events" is a part of the Activities module in Zoho CRM.  An event is an activity that happens at a given place and time. You can find Events on the user's Zoho CRM's home page, Activities home page, Calendar, and in other related records. What are the types of Events? Events are of two types—Recurring and non-recurring events.
                                  • Next Page