Send for Signature via CRM
Hi All,
I am trying to trigger a Zoho Sign Signature request custom function when a specific tag is added to a deal. I am having trouble with the Zoho Sign Request on line 57 - undefined variable
- recordmap.put("zohosign__Account",accountid);
I tried looking through the API literature but I feel like I am missing something. I have installed the Zoho CRM to Zoho Sign module + added Zoho Sign in Developer Space --> connections
- //Get the name, email, client # & booking # necessary fields to merge in the Zoho Sign Document
- record = zoho.crm.getRecordById("Deals",id);
- firstname = record.get("First_Name");
- lastname = record.get("Last_Name");
- name = firstname + "\n" + lastname;
- booking = record.get("Booking_Number");
- client = record.get("Client_Number");
- nameaddress = firstname + "\n" + lastname;
- email = record.get("Email");
- //Parameter map: to create a Zoho Sign document with prefilled fields using a Zoho Sign Template - Note:
- actionMap = Map();
- fieldTextData = Map();
- fieldTextData.put("Name and Address",nameaddress);
- actionMap.put("field_data",{"field_text_data":fieldTextData});
- eachActionMap1 = Map();
- eachActionMap1.put("recipient_name",name);
- eachActionMap1.put("recipient_email",email);
- eachActionMap1.put("Full_name",name);
- eachActionMap1.put("booking",booking);
- eachActionMap1.put("client",client);
- eachActionMap1.put("action_type","SIGN");
- eachActionMap1.put("action_id","111430000000143036");
- eachActionMap1.put("role","Client");
- eachActionMap1.put("verify_recipient","false");
- fieldList = List();
- fieldList.add(eachActionMap1);
- actionMap.put("actions",fieldList);
- submitMap = Map();
- submitMap.put("templates",actionMap);
- parameters = Map();
- parameters.put("is_quicksend","true");
- parameters.put("data",submitMap);
- //Send the Zoho Sign Template with the pre-filled fields to the desired recipient/ recipients
- response = zoho.sign.createUsingTemplate("273382000000083026",parameters);
- //Get the Template Name - used as the name for the record in the "ZohoSign Documents" module in Zoho CRM later
- template = zoho.sign.getTemplateById("273382000000083026");
- templatename = template.get("templates").get("template_name");
- //Get the Zoho Sign Document ID
- requests = response.get("requests");
- docs = requests.get("document_ids");
- docinfo = docs.get(0);
- docid = docinfo.get("document_id");
- //Get the Zoho Sign Request ID
- reqid = requests.get("request_id");
- docinfo = docs.get(0);
- docid = docinfo.get("document_id");
- //Create Map for CRM Record - ZohoSign Documents
- recordmap = Map();
- recordmap.put("Name",templatename);
- recordmap.put("zohosign__Account",accountid);
- recordmap.put("zohosign__Deal",dealid);
- recordmap.put("zohosign__Owner",deal.get("Owner").get("id"));
- recordmap.put("zohosign__Date_Sent",today);
- recordmap.put("zohosign__ZohoSign_Document_ID",docid);
- recordmap.put("zohosign__Module_Record_ID",dealid.toString());
- recordmap.put("zohosign__Document_Deadline",today.addDay(3)); //--> This is arbitrary
- recordmap.put("zohosign__Document_Status","Out for Signature");
- //Check Date and Frequency are additional fields created in the "ZohoSign Documents" CRM Module to control the email notification triggering and field update via workflow rule
- recordmap.put("Check_Date",today.addDay(1));
- recordmap.put("Frequency",0);
- recordmap.put("Request_ID",reqid);
- //Create a Record in the "ZohoSign Documents" module in Zoho CRM
- create = zoho.crm.createRecord("zohosign__ZohoSign_Documents",recordmap);