Send for Signature via CRM

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

  1. 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
  1. //Get the name, email, client # & booking # necessary fields to merge in the Zoho Sign Document
  2. record = zoho.crm.getRecordById("Deals",id);
  3. firstname = record.get("First_Name");
  4. lastname = record.get("Last_Name");
  5. name = firstname + "\n" + lastname;
  6. booking = record.get("Booking_Number");
  7. client = record.get("Client_Number");
  8. nameaddress = firstname + "\n" + lastname;
  9. email = record.get("Email");

  10. //Parameter map: to create a Zoho Sign document with prefilled fields using a Zoho Sign Template - Note:
  11. actionMap = Map();
  12. fieldTextData = Map();
  13. fieldTextData.put("Name and Address",nameaddress);
  14. actionMap.put("field_data",{"field_text_data":fieldTextData});
  15. eachActionMap1 = Map();
  16. eachActionMap1.put("recipient_name",name);
  17. eachActionMap1.put("recipient_email",email);
  18. eachActionMap1.put("Full_name",name);
  19. eachActionMap1.put("booking",booking);
  20. eachActionMap1.put("client",client);
  21. eachActionMap1.put("action_type","SIGN");
  22. eachActionMap1.put("action_id","111430000000143036");
  23. eachActionMap1.put("role","Client");
  24. eachActionMap1.put("verify_recipient","false");
  25. fieldList = List();
  26. fieldList.add(eachActionMap1);
  27. actionMap.put("actions",fieldList);
  28. submitMap = Map();
  29. submitMap.put("templates",actionMap);
  30. parameters = Map();
  31. parameters.put("is_quicksend","true");
  32. parameters.put("data",submitMap);

  33. //Send the Zoho Sign Template with the pre-filled fields to the desired recipient/ recipients
  34. response = zoho.sign.createUsingTemplate("273382000000083026",parameters);

  35. //Get the Template Name - used as the name for the record in the "ZohoSign Documents" module in Zoho CRM later
  36. template = zoho.sign.getTemplateById("273382000000083026");
  37. templatename = template.get("templates").get("template_name");

  38. //Get the Zoho Sign Document ID
  39. requests = response.get("requests");
  40. docs = requests.get("document_ids");
  41. docinfo = docs.get(0);
  42. docid = docinfo.get("document_id");

  43. //Get the Zoho Sign Request ID
  44. reqid = requests.get("request_id");
  45. docinfo = docs.get(0);
  46. docid = docinfo.get("document_id");

  47. //Create Map for CRM Record - ZohoSign Documents
  48. recordmap = Map();
  49. recordmap.put("Name",templatename);
  50. recordmap.put("zohosign__Account",accountid);
  51. recordmap.put("zohosign__Deal",dealid);
  52. recordmap.put("zohosign__Owner",deal.get("Owner").get("id"));
  53. recordmap.put("zohosign__Date_Sent",today);
  54. recordmap.put("zohosign__ZohoSign_Document_ID",docid);
  55. recordmap.put("zohosign__Module_Record_ID",dealid.toString());
  56. recordmap.put("zohosign__Document_Deadline",today.addDay(3)); //--> This is arbitrary
  57. recordmap.put("zohosign__Document_Status","Out for Signature");

  58. //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
  59. recordmap.put("Check_Date",today.addDay(1));
  60. recordmap.put("Frequency",0);
  61. recordmap.put("Request_ID",reqid);

  62. //Create a Record in the "ZohoSign Documents" module in Zoho CRM
  63. create = zoho.crm.createRecord("zohosign__ZohoSign_Documents",recordmap);