Creatorのフォームレポートをこちらの手順に従って公開し、公開キーを取得します。公開キーの書式は次のとおりです。
https://creatorapp.zohopublic.com/<AppOwnerName>/<AppName>/report-perma/<ReportLinkName>/qvGRXuEHg9AQT5CguhV27krp*****
強調表示されているキーは、Delugeスクリプト内で「PublishedLinkKey」として使用します。
Delugeで画像の公開リンクを作成します。Creatorフォーム内の画像用にダウンロードリンクを作成するサンプルコードは、次のとおりです。
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;
CreatorのimageURLのサンプルは、次のとおりです。
https://creatorexport.zoho.com/file/go*****/employee_****/Employee_*****/1309016000000318035/Timer_Screenshot/image-download/qvGRXuEHg9AQT5CguhV27krp*****?filepath=/1656509699030.png
このimageURLを使用して、Creatorの画像をWriterに差し込むことができます。
画像をアップロードし、Zoho WorkDriveで外部ダウンロードリンクをこちらの手順に従って作成します。WorkDriveのURLのサンプルは、次のとおりです。
https://workdrive.zohoexternal.com/external/b24042070f8fb42d******/download?directDownload=True
このURLをDelugeスクリプト内でimageURLとして渡し、Zoho WriterのDelugeタスクまたはZoho WriterのAPIを使用して出力操作を実行します。
Zoho WriterのAPIを使用して文書を差し込み、メールで送信するDelugeのサンプルコードは、次のとおりです。
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: ''
];