record_id parameter with the Zoho Writer Merge API. This allows Writer to automatically fetch data from your Creator record without manually building the merge data map.
The Solution
According to the official Merge and Sign documentation, instead of using merge_data, you can pass the record_id and Writer will fetch the data internally:
record_id parameter, Zoho Writer automatically retrieves the field values from your Creator record - no need to manually construct a merge data map.
Here's a complete Deluge function that demonstrates using the Creator record ID with the Merge and Sign API:
void zWriterSign.sendForSigning(Form_Name fnRecord)
{
//fetch employee record
eeRecord = Employee[ID = fnRecord.Employee_Lookup];
//
//Writer template ID (found in document URL)
templateId = "dfd8f76sf0dfdfeb8974ifcx9873d9876d8s03";
//
//Use the Creator record ID - Writer will fetch the data automatically
recordId = fnRecord.ID.toString();
//
param = Map();
param.put("record_id",recordId);
param.put("service_name","zohosign");
param.put("filename",fnRecord.Field_Name);
//
//Build signer list
signerList = List();
//
//First signer - approver
signerObj1 = Map();
signerObj1.put("recipient_1",ifnull(eeRecord.Email,"fallback@example.com"));
signerObj1.put("action_type","approve");
//approve|sign|view|in_person_sign
signerObj1.put("language","en");
signerList.add(signerObj1);
//
//Second signer - actual signer
signerObj2 = Map();
signerObj2.put("recipient_2",fnRecord.Signer_Email);
signerObj2.put("action_type","sign");
//approve|sign|view|in_person_sign
signerObj2.put("language","en");
signerList.add(signerObj2);
//
param.put("signer_data",signerList);
param.put("sign_in_order","true");
//
//Optional: custom message
if(!fnRecord.Custom_Message.isEmpty())
{
param.put("message",fnRecord.Custom_Message);
}
//
//Optional parameters
param.put("reminder_period","3");
param.put("set_expire","7");
param.put("test_mode",true);
//
//Execute the merge and sign request
newSignMerge = invokeurl
[
url :"https://www.zohoapis.eu/writer/api/v1/documents/" + templateId + "/merge/sign"
type :POST
parameters:param
connection:"zwritersign"
];
//
info newSignMerge;
}| Data Center | Region | API Domain |
|---|---|---|
| US | United States | https://www.zohoapis.com/writer/api/v1/... |
| EU | Europe | https://www.zohoapis.eu/writer/api/v1/... |
| IN | India | https://www.zohoapis.in/writer/api/v1/... |
| AU | Australia | https://www.zohoapis.com.au/writer/api/v1/... |
| JP | Japan | https://www.zohoapis.jp/writer/api/v1/... |
| CA | Canada | https://www.zohoapis.ca/writer/api/v1/... |
| CN | China | https://www.zohoapis.com.cn/writer/api/v1/... |
creator.zoho.eu, use zohoapis.eucreator.zoho.com, use zohoapis.comBefore using this API, ensure you have:
|
1. Template Access Open your Writer template at least once from the Zoho Writer dashboard before sending API requests. Navigate to the hamburger menu → Automate tab. |
2. OAuth Connection Create a connection in Creator with the required scopes: ZohoWriter.documentEditor.ALLZohoWriter.merge.ALLZohoSign.documents.ALL
|
Template Field Mapping:
Your Writer template merge fields must match your Creator form field names exactly. When using record_id, Writer automatically maps fields by their link names.
record_id approach works with multiple Writer Merge APIs:
| API | Endpoint | Purpose |
|---|---|---|
| Merge and Sign | /merge/sign |
Merge document and send for electronic signature via Zoho Sign |
| Merge and Email | /merge/email |
Merge document and send as email attachment |
| Merge and Store | /merge/store |
Merge document and save to Zoho WorkDrive |
| Merge Document | /merge |
Merge and return download link (expires in 2 days) |
| Merge and Share Fillable | /merge/sharetofill |
Generate pre-filled fillable links for data collection |
//Available action types for signers:
signerObj.put("action_type","sign"); //Requires signature
signerObj.put("action_type","approve"); //Approval only, no signature
signerObj.put("action_type","view"); //View only access
signerObj.put("action_type","in_person_sign"); //In-person signing
//Optional: Specify recipient name
signerObj.put("recipient_name","John Smith");
//Optional: Add private notes to signer
signerObj.put("private_notes","Please review section 3 carefully");
//Optional: Alternative delivery methods
deliveryType = Map();
deliveryType.put("type","sms"); //or "whatsapp"
deliveryType.put("countrycode","+1");
deliveryType.put("phonenumber","5551234567");
signerObj.put("delivery_type",{deliveryType});| Issue | Cause | Solution |
|---|---|---|
| "Invalid merge data" error | Record ID not found or wrong format | Ensure record_id is passed as a string using .toString() |
| Empty merge fields | Field name mismatch between Creator and Writer | Verify template merge field names match Creator field link names exactly |
| Authentication failure | Wrong data center domain | Match API domain to your account's data center |
| "Template not accessible" error | Template not opened in Writer UI | Open template once from Writer dashboard → Automate tab |
| Connection scope error | Missing OAuth scopes | Regenerate connection with all required scopes listed above |
param.put("test_mode",true); during development. This allows you to test the merge without consuming Zoho Sign credits (though the output will contain a watermark). Remove this parameter for production use.
Writer is a powerful online word processor, designed for collaborative work.