How to set up image field merges from Zoho Creator to Zoho Writer

How to set up image field merges from Zoho Creator to Zoho Writer

Overview

Zoho Writer supports only public image URL to perform merge operations. So to achieve this please add an image field in both your Creator app and Writer's merge template and use one of the two ways: 

Steps

  1. Publish your Creator's form report with these steps and get the published key. The published key will be in this format: 

 https://creatorapp.zohopublic.com/<AppOwnerName>/<AppName>/report-perma/<ReportLinkName>/qvGRXuEHg9AQT5CguhV27krp***** 

The highlighted key will be used as 'PublishedLinkKey' in the Deluge script.

  1. Create public links for your images in Deluge. Here's a sample code to create downloadable link of your images in the Creator form.

employeerecord = Employee_Timesheet_Form[ID==input.ID];

info employeerecord.Timer_Screenshot;

imageLink = employeerecord.Timer_Screenshot.getsuffix("image/");

imageLink = employeerecord.getPrefix("\"");

imageURL = "https://creatorexport.zoho.com/file/<AppOwnerName>/<AppName>/<ReportLinkName>/" + input.ID + "/<ImageFieldName>/image-download/<PublishedLinkKey>?filepath=/" + imageLink;  

info imageURL; 

 

Here's a sample Creator imageURL:

 

https://creatorexport.zoho.com/file/go*****/employee_****/Employee_*****/1309016000000318035/Timer_Screenshot/image-download/qvGRXuEHg9AQT5CguhV27krp*****?filepath=/1656509699030.png

  1. You can use this imageURL to merge the Creator image with Writer.

  1. Upload your image and create an external download link in Zoho WorkDrive with these steps. Here's a sample WorkDrive URL:

https://workdrive.zohoexternal.com/external/b24042070f8fb42d******/download?directDownload=True

  1. Pass this URL as imageURL in your Deluge script and perform your output operations via Zoho Writer's Deluge tasks or Zoho Writer's API. 

Here's a sample Deluge code to merge and send the document as an email with Zoho Writer's API.

data= map();

data.put("employee_name",employeerecord.Employee_Name);

data.put (“employee_email”, employeerecord.Employee_email);

data.put("project_name", employeerecord.Project_Name);

data.put("date",employeerecord.Date_field);

data.put("total_hours_worked", employeerecord.Total_Hours_Worked);

data.put("timer_screenshot", imageURL);

data.put("task_details", employeerecord.Task_Details);

data.put("date", employeerecord.Subform_Date);

data.put("hours_worked", employeerecord.Hours_worked);

data.put("task_description", employeerecord.Task_Description);

param = Map();

param.put("message", "Please find your work details for the past week");

param.put("subject", "Work Details");

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

param.put("output_format", "inline");

param.put("recipient_email",employeerecord.Employee_email);

param.put("from_email", "paxyz@zylker.com");

invokeurl

[

url: "https://zohoapis.com/writer/api/v1/documents/eb4kob******/merge/email"

type: post

parameters: param

connection: ""

];