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

          • [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
          • 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
          • 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

                                  • Problem with reports due to "Connected" items change - Yes this IS a problem

                                    Now that the change has been made to use "connected" items I can no longer run the reporting I need in CRM. I should be able to start with Deals as the parent, connect down to the Account (Account_Name) on the deal as the child, then to any child items
                                  • Introducing notifications in the vendor portal

                                    Imagine this: You're a recruiter working with multiple vendors on a high-volume hiring project. You’ve just updated a job description after a last-minute change from the hiring manager. One of your vendors, however, is still working off the older version
                                  • CRM limit reached: only 2 subforms can be created

                                    we recently stumbled upon a limit of 2 subforms per module. while we found a workaround on this occasion, only 2 subforms can be quite limiting in an enterprise setting. @Ishwarya SG I've read about imminent increase of other components (e.
                                  • LESS_THAN_MIN_OCCURANCE - code 2945

                                    Hi I'm trying to post a customer record to creator API and getting this error message. So cryptic. Can someone please help? Thanks Varun
                                  • Analytics for notes created

                                    Is there a way I can see how many notes were created per day? Via reporting or analytics?
                                  • Cannot update Recurring_Activity on Tasks – RRULE not accepted

                                    Hello, I am trying to update Tasks in Zoho CRM to make them recurring yearly, but I cannot find the correct recurrence pattern or way to update the Recurring_Activity field via API or Deluge. I have tried: Sending a string like "RRULE:FREQ=YEARLY;INTERVAL=1"
                                  • Add image to report...

                                    Greetings, I send a weekly color coded report via Creator email. I would like to add the legend somewhere in the report. Header, footer where ever. I have the legend saved on Google Drive and can access it via shared link. Sure someone has wanted to add
                                  • More controls for User Fields in CRM

                                    Dear All, We are here with a minor but crucial enhancement to the user fields—now set accessibility permissions to the records for user field. User field allows you to extend co-ownership of records to your peers. You can collaborate with them for certain
                                  • Calls to accounts rather than leads or contacts?

                                    So..... We have a dilemma and I'm hoping someone has encountered this before and figured out a fix. We have just migrated to Zoho. It's great.....expect for how "Calls" are handled.... We are B2B. We do not use the leads module. A "Lead/Prospect" for
                                  • Image Upload Field | Zoho Canvas

                                    I'm working on making a custom view for one of our team's modules. It's an image upload field (Placement Photo) that would allow our sales reps to upload a picture of the house their working on. However, I don't see that field as a opinion when building
                                  • Power of Automation :: Automated 'Delayed & Closed' Status Update Based on Due Date

                                    Hello Everyone, A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate
                                  • Lead Blueprint transition in custom list view

                                    Hi, Is It possible to insert the Blueprint transition label in a custom Canvas list view? I am using Lead module. I see the status, but it would be great if our users could execute the Blueprint right from the list view without having to enter the detailed
                                  • Range names in Zoho Sheet are BROKEN!

                                    Hi - you've pushed an update that has broken range names. A previously working spreadsheet now returns errors because the range names are not updating the values correctly. I've shared a video with the support desk to illustrate the problem. This spreadsheet
                                  • populate email address and name in zoho desk?

                                    Is it possible to populate the email address and name in the zoho desk widget? We only use it in the context of an authenticated user, so we already know the user's name and email. Thanks,
                                  • Are there default/pre-built dashboards in Zoho Desk?

                                    Hi, I am looking for some pre-built dashboard templates in Zoho Desk, similar to what we can find in CRM/Projects, etc Thank you
                                  • SAP S/4 HANA to CRM Integration - change the SAP Client ID

                                    Hi I am trying to push the business partners from SAP S/4 HANA to ZOHO CRM module. The SAP Client ID is 421 in my case....kindly let me know how do I specify the sap client because it's a dropdown with specific values as of now. Thanks Ravi Aswani
                                  • Adding branded signature to tickets reply

                                    Hi, i am unable to figure out how to add signatures with logo to tickets reply. please advice .
                                  • How to share ticket numbers across different ticket types

                                    I'm running an event and have three different ticket types. Add on Event + Main Event - Early bird Main Event only - Early bird Add on Event only - Early bird And Standard class - shown but not available until early bird finishes Add on Event + Main Event
                                  • Adding Social Media Buttons to Basic Campaigns

                                    Hi, I'm quote new to using Zoho Campaigns and I can't work out how to add Social Media Buttons into my basic campaign? In MailChimp there's a button that brings the icons into your campaign for you. I've tried adding the social media icons as 'buttons' in Zoho but it's not looking great. Can anyone help? Thanks!
                                  • Hide Inactive Social Sign-In Providers from Login Screen

                                    Hello Zoho Team, We hope you are doing well. Currently, Zoho One allows admins to configure security policies and enable or disable Social Sign-In options for third-party providers such as Apple, Google, Microsoft, LinkedIn, Yahoo, Twitter, Facebook,
                                  • [Free Webinar] AI Agents in Zoho Creator - Creator Tech Connect

                                    Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
                                  • Download All Attached Files

                                    It would be extremely useful to have "download-all" functionality for downloading files attached to a task, subtask, comment, forum post or hosted in the "Documents" section etc. We've instructed our users to zip multiple files prior to uploading, but of course they forget all the time. Having to download lots of files one-at-a-time off a comment or task wastes a lot of time.
                                  • Ship via Carrier Not Working Since Commerce Update

                                    Since the recent update to the Commerce platform, I can no longer use the ship via carrier function. It will take me to the address screen and let me verify them but when I go to save and move tot he next screen it will not do anything. This is happening
                                  • automations: Can I execute a step on a specific date?

                                    I have created a form in Zoho forms, and created a contacts list. I have also begun setting up an automation with the intention of sending the form to the contact list on a specific date every month (via email) for the entire year (essentially sending
                                  • Zoho Expense - The ability to add detail to a Trip during booking

                                    As an admin, I would like the ability to add more detail to the approved Trips. At present a requestor can add flights, accommodation details and suggest their preferences. It would be great if the exact details of the trip could be added either by the
                                  • Adding Folders in Android App

                                    Is it possible to create a new email folder within the Zoho Mail Android app?  Or can this only be done from the desktop version of Zoho Mail? Cheers!
                                  • Schedule Exports for Regular Project Updates

                                    Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
                                  • Question about custom fields using Pivot Tables.

                                    I have created a pivot table showing annual revenue of a client and how much payment that client is paying my company. Is there a way using pivot table to add an additional field that subtracts those to fields / shows me a percentage of that difference?
                                  • Request for Light/Dark Mode

                                    Would love the ability to switch between Light and Dark mode similar to Zoho CRM. https://help.zoho.com/portal/en/community/topic/introducing-dark-mode-light-mode-a-new-look-for-your-crm
                                  • Journey Email - Ignored Contacts

                                    I have a journey setup which simply sends a string of emails over time. For some reason I am getting large amounts of the contacts who enter the first email being ignored and I can't find anywhere in reports or audit logs why these contacts are not
                                  • Involved account types are not applicable when create journals

                                    { "journal_date": "2016-01-31", "reference_number": "20160131", "notes": "SimplePay Payroll", "line_items": [{ "account_id": "538624000000035003", "description": "Net Pay", "amount": 26690.09, "debit_or_credit": "credit" }, { "account_id": "538624000000000403", "description": "Gross", "amount": 32000, "debit_or_credit": "debit" }, { "account_id": "538624000000000427", "description": "CPP", "amount": 1295.64, "debit_or_credit": "debit" }, { "account_id": "538624000000000376", "description":
                                  • Zoho Books - Include Payment Terms as a Custom View filter

                                    It would be great if you could created a custom view based on Payment Terms. This would be really handy for seeing a list of customers who have credit terms. A workaround is not required. I could do something with a creditor checkbox, but it would be
                                  • How to update changed purchase account of item in invoice

                                    I have selected the wrong purchase account for various articles and created invoices. I had to adjust the purchase account in the article afterwards, but the old purchase account is still posted in the transaction-journal of the invoice. To adjust the
                                  • Help - Zoho CRM notification on mobile (IOS/Android)

                                    Hello Community! Can I get the IOS/Andoid CRM app to notify me of events, calls, etc. due as I can with MANY other apps?   I am running the free Zoho I would like this to be native to the Zoho CRM app. I do not want to write a sep. mobile app
                                  • Zoho Books Idea - Include another field in Bank Details for Address

                                    Hi Books team, Currently use the Description field in the Bank Details to store the bank's address. This works fine but it would be great if you could add another field for Bank Address, so that other notes about the bank account could be stored in the
                                  • a question about the COQL API v8

                                    When I specify eight or more values in a WHERE IN clause and execute it, an error occurs. Is there a limit to the number of values that can be specified in a WHERE IN clause? ↓Error select * FROM Vendors WHERE (id in (1, 2, 3, 4, 5, 6, 7, 8, 9)) ↓Success
                                  • Zoho Books Idea - Bank Details Button on Banking

                                    Hi Books team, Sometimes I'm asked to share bank details with a customer or a colleague. So I go to the Banking Module, find the correct bank account, click Setting > Edit, then copy and paste the bank details. Wouldn't it be great if there was a button
                                  • JS SDK 8.0 – TypeError: Cannot read properties of undefined (reading 'getCacheStore') with sample code

                                    Hello Zoho Support Team, I’m integrating the Zoho CRM JavaScript SDK v8.0 and I’m getting the error below when running your official sample. I tested directly from: https://github.com/zoho/zohocrm-javascript-sdk-8.0/blob/main/samples/create_records_sample/create_records.js
                                  • Function #55: Convert multiple quotes to single SO using Custom Button

                                    Hello everyone, and welcome back to our series! In Zoho Books, after a quote is accepted by your customer, it can be converted into a sales order or an invoice. Often, a customer might have multiple quotes, and for easier billing or upon the customer's
                                  • Time based workflow without edit/action

                                    Hello I need help solving this problem if possible. We have Deals come into the CRM via Live Transfer which have the field properties: Stage = New Channel = Inbound Some of them don't get answered so we want these to automatically go into our Outbound
                                  • Next Page