How to handle image fields in Mail Merge using Deluge Script?

How to handle image fields in Mail Merge using Deluge Script?

To achieve this, you need to provide a Public URL for the image fields. Zoho Writer only accepts Public URL. 

If you only have image file object and not a public url, then follow the below steps;

1. Upload image to WorkDrive:

Use the below script and upload the image to WorkDrive;


workdrive_folder_id = "g576*****";
responseData = zoho.workdrive.uploadFile(image1,workdrive_folder_id,image1.getFileName(),true,"writermerge");  //writermerge -> connection name
workdrive_resourceid = "";
if(responseData != null){
  responseList = responseData.get("data");
  responseData = responseList.get(0);
  workdrive_resourceid = responseData.get("attributes").get("resource_id");
}


2. Create an external download link:

Use the below script to create an external download link for the image from WorkDrive.


attribute = Map();
attribute.put("resource_id",workdrive_resourceid);  //workdrive document resource id
attribute.put("allow_download",true);
attribute.put("request_user_data",false);
attribute.put("link_name","sample_link");
attribute.put("expiration_date","2021-12-12");

attributeMap = Map();
attributeMap.put("attributes",attribute);
attributeMap.put("type","links");
param = Map();
param.put("data",attributeMap);
paramString = param.toString();
mp = Map();
mp.put("Accept","application/vnd.api+json");
makeExternalLink = invokeurl
[
 type :POST
 parameters:paramString
 headers:mp
 connection:"writermerge"
];
info makeExternalLink;

linkobj = Map();
linkobj = makeExternalLink.get("data");
downloadlink = "";
if(linkobj != null)
{
 constructURl = linkobj.get("attributes").get("download_url");
 downloadlink = constructURl + "?directDownload=True";  //writer merge with this value 
}

Sample downloadlink:

The highlighted 'download link' in the response can be used as the image field input value. 









    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








                                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

                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                        Zoho Marketing Automation

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







                                                                                            You are currently viewing the help articles of Sprints 1.0. If you are a user of 2.0, please refer here.

                                                                                            You are currently viewing the help articles of Sprints 2.0. If you are a user of 1.0, please refer here.



                                                                                                  • Related Articles

                                                                                                  • How to use Zoho WorkDrive images into Writer merge fields?

                                                                                                    Zoho Writer only accepts Public URL for the image fields in Mail merge. If the images are stored in Zoho WorkDrive, you can create a downloadable link and use it as an input value for the image field. This can be done in the following three ways; a) ...
                                                                                                  • How to Pass Image Fields Values in Zoho CRM's Mail Merge via API?

                                                                                                    When conducting a mail merge from Zoho CRM using our Merge APIs, if the merge template includes image fields, you'll need to construct the value for those image fields on your end. Zoho CRM will solely provide the Preview Image ID value for the image ...
                                                                                                  • Working with Fields

                                                                                                    Supported field types Supported field types Description Possible Values in the data source Rendered as Notes Plain Text The value of the field is placed as a string in the document. “test” “test” You can select the field in the document and apply the ...
                                                                                                  • How to configure workflows to run Writer mail merge tasks?

                                                                                                    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. (Ex: Merge ...
                                                                                                  • Repeat Blocks in merge

                                                                                                    Repeat Field is one of the advance merge fields that lets you repeat blocks of information for each record in your data source automatically. The following image shows how a template document as well as the output document will look after using the ...
                                                                                                    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