Prefill "field_data" on Zoho Sign not populating
I'm trying to prefill some information from CRM Plus into a template using the zoho sign deluge task but for some reason, the data passed into the "field_data" object doesn't prefill the form.
A few notes
- I've confirmed that the function is successfully getting the info from CRM and applying it to the object
- Some of the returned fields from the CRM are null as they hadn't been entered yet (which is a possible use case, we'd like to prefill the info we have leaving anything we don't have blank)
- The field_data object is using field_text_data, field_date_data, field_boolean_data, and field_radio_data to hold the field data
- I've confirmed that the field labels provided in the field_data object match the field labels in the template
Code:
- PacketID is a function argument which is a zoho record
- A wrapper function is used for the zoho crm GetRecordById task which returns null to the parent function upon an error
- The standard State field in CRM was replaced with a dropdown for both Accounts and Contacts
- //Structure Variable Declarations
- response = Map();
- params = Map();
- data = Map();
- templates = Map();
- actions = List();
- field_data = Map();
- field_date_data = Map();
- field_boolean_data = Map();
- field_text_data = Map();
- field_radio_data = Map();
- //Get Records from CRM
- Packet = standalone.GetRecordById("Application_Packets",PacketID);
- if(Packet.isNull())
- {
- info "Error getting Application Packet";
- return null;
- }
- Participant = standalone.GetRecordById("Client_Company_Relations",Packet.get("Application_Participant").get("id"));
- if(Participant.isNull())
- {
- info "Error getting Application Participant";
- return null;
- }
- Contact = standalone.GetRecordById("Contacts",Packet.get("Client_Contact_Record").get("id"));
- if(Contact.isNull())
- {
- info "Error getting Contact";
- return null;
- }
- Account = standalone.GetRecordById("Accounts",Packet.get("Company_Account_Record").get("id"));
- if(Account.isNull())
- {
- info "Error getting Account";
- return null;
- }
- //Apply TemplateID to response structure
- response.put("templateID",<template id>); //template id redacted
- //Apply field data to field_data child objects
- field_text_data.put("Business Legal Name",Account.get("Account_Name"));
- field_text_data.put("Business DBA Name",Account.get("DBA_Name"));
- field_date_data.put("Start Date",Account.get("Business_Start_Date").toString("dd MMMM yyyy"));
- field_text_data.put("Business Website",Account.get("Website"));
- field_text_data.put("Business Address 1",Account.get("Street"));
- field_text_data.put("Business Address 2",Account.get("Street_2"));
- field_text_data.put("Business City",Account.get("City"));
- field_radio_data.put("Business State",Account.get("State"));
- field_text_data.put("Business Zip",Account.get("Zip_Code"));
- field_text_data.put("Business Phone 1",Account.get("Phone"));
- field_text_data.put("Business Phone 2",Account.get("Secondary Phone"));
- field_text_data.put("Business Fax",Account.get("Fax"));
- field_text_data.put("First Name",Contact.get("First_Name"));
- field_text_data.put("Last Name",Contact.get("Last_Name"));
- field_radio_data.put("Salutaion",Contact.get("Salutation"));
- field_text_data.put("Business Title",Participant.get("Company_Title"));
- field_text_data.put("Owner Percent",Participant.get("Ownership_Percent"));
- field_date_data.put("DOB",Contact.get("Date_of_Birth").toString("dd MMMM yyyy"));
- field_boolean_data.put("Is US Citizen",Contact.get("Is_US_Citizen"));
- field_radio_data.put("Preferred Contact Method",Contact.get("Preferred_Contact_Method"));
- field_text_data.put("Address 1",Contact.get("Mailing_Street"));
- field_text_data.put("Address 2",Contact.get("Mailing_Street_2"));
- field_text_data.put("City",Contact.get("Mailing_City"));
- field_radio_data.put("State",Contact.get("State"));
- field_text_data.put("Zip",Contact.get("Mailing_Zip"));
- field_text_data.put("Primary Phone",Contact.get("Primary_Phone"));
- field_text_data.put("Secondary Phone",Contact.get("Secondary_Phone"));
- field_text_data.put("Fax",Contact.get("Fax"));
- field_text_data.put("Client Email",Contact.get("Email"));
- //Apply child objects to field_data
- field_data.put("field_text_data", field_text_data);
- field_data.put("field_boolean_data", field_boolean_data);
- field_data.put("field_date_data", field_date_data);
- field_data.put("field_radio_data", field_radio_data);
- //Create Applicant Signer Action
- signerObj1 = Map();
- signerObj1.put("recipient_name",Contact.get("First_Name") + " " + Contact.get("Last_Name"));
- signerObj1.put("recipient_email",Contact.get("Email"));
- signerObj1.put("action_id","383560000000030044");
- signerObj1.put("action_type","SIGN");
- signerObj1.put("signing_order",1);
- signerObj1.put("role","Applicant");
- signerObj1.put("verify_recipient",false);
- signerObj1.put("private_notes","Kindly confirm and complete all the details in the funding application and accept it by signing.");
- actions.add(signerObj1);
- //Create Representative Signer Action
- signerObj2 = Map();
- signerObj2.put("recipient_name",Packet.get("Owner").get("name"));
- signerObj2.put("recipient_email",Packet.get("Owner").get("email"));
- signerObj2.put("action_id","383560000000030046");
- signerObj2.put("action_type","VIEW");
- signerObj2.put("signing_order",2);
- signerObj2.put("role","Representative");
- signerObj2.put("verify_recipient",false);
- actions.add(signerObj2);
- //Build and return completed Sign Args
- templates.put("field_data", field_data);
- templates.put("actions",actions);
- data.put("templates", templates);
- params.put("data",data);
- params.put("is_quicksend", true);
- response.put("params", params);
- return response;
These generated parameters are then passed to another deluge function that sends the Sign request (also using PacketID as a function parameter and a wrapper function for zoho's toMap function).
- args = standalone.ToMap(standalone.GetAppOptions(PacketId));
- signResponse = zoho.sign.createUsingTemplate(args.get("templateID"), args.get("params"), "zohosign");
- return signResponse;
This successfully sends the sign request to the specified record but it doesn't prefill the data. Any help would be greatly appreciated!
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Zoho Orchestly Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.