customerMap = zoho.crm.getRecordById("Accounts",customerId.toLong()); name = customerMap.get("Account_Name"); to_email = customerMap.get("customer_Email"); merge_template_name = "LOI"; //Replace with your mail merge template name info name; info to_email; input_json = "{'sign_mail_merge':[{'mail_merge_template':{'name':'" + merge_template_name + "'},'file_name':'letterofintent','sign_in_order':false,'signers':[{'recipient_name':'" + name + "','action_type':'sign','recipient':{'type':'email','value':'" + to_email + "'}}]}]}"; header_data = Map(); header_data.put("Content-Type","application/json"); response = invokeurl [ url :"https://www.zohoapis.com/crm/v5/Accounts/" + customerId.toLong() + "/actions/sign_mail_merge" type :POST parameters:input_json connection:"zylkercrm" ]; //Replace above connection name with your connection name info response; details = response.getJSON("sign_mail_merge").toJSONList(); link = ""; for each detail in details { link = detail.get("details").get("report_link"); info link; } mp = Map(); mp.put("Document_Sign_Details",link); update = zoho.crm.updateRecord("Accounts",customerId.toLong(),mp); return ""; |
customerMap = zoho.crm.getRecordById("Accounts",customerId.toLong()); to_email = customerMap.get("customer_Email"); from_email = customerMap.get("Owner").get("email"); support_Type = customerMap.get("Support_Type"); if (support_Type == "Premium" ) { merge_template_name = "SLA_Premium"; } else { merge_template_name = "SLA_Std"; } //Replace above merge template names with your merge template names input_json = "{'send_mail_merge':[{'mail_merge_template':{'name':'" + merge_template_name + "'},'from_address':{'type':'email','value':'" + from_email + "'},'to_address':[{'type':'email','value':'" + to_email + "'}],'subject':'Hi there','type':'attachment','attachment_name':'testdocument','message':'Big Deal'}]}"; header_data = Map(); header_data.put("Content-Type","application/json"); response = invokeurl [ url :"https://www.zohoapis.com/crm/v5/Accounts/" + customerId + "/actions/send_mail_merge" type :POST parameters:input_json connection:"zylkercrm" ]; //Replace above connection name with your connection name input_json = "{'download_mail_merge':[{'mail_merge_template':{'name':'" + merge_template_name + "'},'output_format':'pdf'}]}"; header_data = Map(); header_data.put("Content-Type","application/json"); //The merged document is stored to file_object file_object = invokeurl [ url :"https://www.zohoapis.com/crm/v5/Accounts/" + customerId.toLong() + "/actions/download_mail_merge" type :POST parameters:input_json connection:"zylkercrm" ]; //Replace above connection name with your connection name response = zoho.crm.attachFile("Accounts",customerId,file_object); return ""; |
Writer is a powerful online word processor, designed for collaborative work.