// 1. You need to use tags in the Template
/// Here is link for tags: https://help.zoho.com/portal/en/kb/zoho-sign/user-guide/sending-a-document/articles/automatic-field-addition-in-zoho-sign
dealLDetails = zoho.crm.getRecordById("Deals",DealID);
// info dealLDetails;
// getAllFieldsResponse = invokeurl
// [
// url :"https://writer.zoho.com/api/v1/documents/flo7ld4ba09726a694424994054acbb636e81/fields"
// type :GET
// connection:"zoho_crm"
// ];
// info getAllFieldsResponse;
fieldTextData = Map();
fieldTextData.put("Deal_Name",dealLDetails.get("Deal_Name"));
fieldTextData.put("Stage",dealLDetails.get("Stage"));
fieldTextData.put("Owner",dealLDetails.get("Owner").get("name"));
contact_roles = zoho.crm.getRelatedRecords("Contact_Roles","Deals",DealID);
// info contact_roles;
contact_List = List();
count = 0;
signerList = List();
for each contact in contact_roles
{
count = count +1;
name = contact.get("Full_Name");
contact_map = Map();
contact_map.put("Contact_Roles.Full_Name",name);
contact_map.put("Contact_Roles.First_Name", count);
signerMap = Map();
signerMap.put("recipient_"+count, contact.get("Email"));
signerMap.put("action_type", "sign");
signerMap.put("language","en");
contact_List.add(contact_map);
signerList.add(signerMap);
}
fieldTextData.put("Contact_Roles",contact_List);
data_mp = Map();
data_mp.put("data",fieldTextData);
params = Map();
params.put("merge_data",data_mp);
params.put("service_name","zohosign");
params.put("signer_data",signerList);
params.put("sign_in_order","true");
// optional
params.put("message","Please find the document to be signed here");
//optional
params.put("reminder_period","15");
//optional
params.put("set_expire","30");
//optional
documentid = "flo7ld4ba09726a694424994054acbb636e81";
templatename = "Test Shareholder Agreement";
params.put("filename",templatename);
url = "https://zohoapis.com/writer/api/v1/documents/" + documentid + "/merge/sign";
info params;
/////////////////////////////
documentObj = invokeurl
[
url :url
type :POST
parameters:params
connection:"zoho_crm"
];
info documentObj;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter