How to manage merge field IDs and subform fields when using Zoho Writer's merge APIs

How to manage merge field IDs and subform fields when using Zoho Writer's merge APIs

1. Why are merge field values not merged or replaced correctly during the merge operation?

If merge values are not properly replaced or are missing in the output document, it may be because the field values were not passed to the correct field IDs in the merge input data. Ensure the exact field IDs are used to avoid this issue.

2. How to obtain merge field IDs and use them with Merge APIs?

Option A: Get Field IDs via the Writer User Interface
  1. Open the merge template and navigate to the Automate tab in the right panel.
  2. Click on Manage Fields in the merge panel, then select Show Field ID to retrieve the exact field IDs.
  3. For subform field IDs:
    • Navigate to the Subform tab.
    • Expand the subform and click Show Field ID to view and copy the field IDs.


Option B: Get Field IDs using APIs

Field IDs can also be retrieved programmatically using Writer's REST APIs or Deluge tasks

3. Why aren’t subform or multi-line field values merged correctly in PDF templates?

There is a known technical limitation in rendering or replacing subform values within repeat regions on PDF templates. We are actively working to address this limitation and improve the user experience for merging repeat regions in PDF templates.

WorkaroundTo ensure data populates correctly, insert a Text Box in the template and place the repeat tables or regions inside it. This will allow the data to merge as expected.



In Merge template, Subform or Related List fields are special merge fields that must be passed in the correct format for proper merging.

Steps to Map Subform Fields:
  1. In the Writer merge template, insert a subform table or repeat region using the Repeat button under Advanced Merge Fields.
  2. Retrieve the merge field IDs for the subform or related list fields as described earlier (in Question#2), and map the values in the input JSON data using the format below.
Example#1: Sample code to Merge Input Data with Subforms or Related Lists Fields via API

                  {

  "data": [

    {

      "customer_name": "Amelia",

      "customer_address": "13th Street, USA",

      "customer_email_address": "amelia@zylker.com",

      "customer_phone_number": "9876543210",

      "invoice_number": "123456",

      "items": [

        {

          "items.item_code": "123",

          "items.item_name": "Fastrack Revoltt FS1",

          "items.item_description": "Specifications",

          "items.item_replacement": "Yes"

        },

        {

          "items.item_code": "1278",

          "items.item_name": "Samsung Refridgerator",

          "items.item_description": "Specifications",

          "items.item_replacement": "Yes"

        }

      ]

    },

      {
       "customer_name": "John",
       "customer_address": "15th Street, India",
      ....
      }

  ]

}
Example#2: Sample Code to Map Subform/Related List Fields via Deluge

If the merge record includes two subforms, such as items and repairs, use the following approach:
  • Fetch data using APIs like getRecords for integrations (e.g., CRM, Recruit, People).
  • Map the values for both main and subform fields as shown above.

dataMap = Map();

recordsData.put("customer_name": "Amelia");

recordsData.put("customer_address": "13th Street USA");

recordsData.put("customer_email_address": "amelia@zylker.com");

recordsData.put("customer_phone_number": "9876543210");

recordsData.put("invoice_number": "123456");

 

//Subform1

itemsList = list();

itemMap = Map();

itemmap.put("items.item_code": "123");

itemmap.put("items.item_name": "Fastrack Revoltt FS1");

itemmap.put( "items.item_description": "<p><b>Specifications</b></p>");

itemmap.put("items.item_replacement": "Yes");

itemsList.add(itemmap);

 

//subform2

repairList = list();

repairDetails = Map();

repairDetails.put("Repairs.Service_code", "R100");

repairDetails.put("Repairs.Description", "Faulty belt");

repairDetails.put("Repairs.Quantity", "5");

repairDetails.put("Repairs.Price", 10000);

repairList.add(repairDetails);

 

recordsData.put("items", itemsList);

recordsData.put("Repairs", repairList)

 

mergedata = Map();

mergedata.put("merge_data", {"data": recordsData});

//pass this merge data to respective merge api like mentioned below

 

zoho.writer.mergeAndSend("eb4kob4cf65bb6d074af7a7de21e561119eb9", "pdf", "amelia@zylker.com", mergedata, "writer_name");

For more details, refer to the CRM Integration Guide.

NotesFor a complete guide on passing values for all merge field types, refer to the Comprehensive Merge Field Documentation.


        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








                                                                                                                                      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