How to set up a workflow to retain the association between a lead and a Zoho Sign Document?
Scenario: Can I set up a workflow to retain the association between a lead and a Zoho Sign Document after the lead is converted to a Contact or Account?
If you are using the Zoho Sign extension in CRM, when a lead is converted to a Contact/Account, the Contact in 'Zoho Sign Documents' module will not be updated. This is a workaround step to update the details in the Zoho Sign Documents module each time a lead is converted.
- Navigate to Setup -> Customization -> Modules and Fields -> Leads -> Edit Layout.
- Add a new field of type 'Single Line' with the name 'Lead Conversion ID'.
- Edit the properties of this field, then select the checkbox for Also create for Account.
- Navigate to Setup -> Automation -> workflow rules.
- Create a new rule: module = Leads.
- On record action -> Create -> All Leads -> create new function.
- Edit arguments of the function -> set name of argument as 'leadId' and select value from 'Leads' module and 'Lead Id' field.
- Copy and paste the below code and save the function and workflow.
zoho.crm.updateRecord("Leads", leadId, {"Lead_Conversion_ID":leadId+""});
- Navigate to Setup-> Automation -> workflow rules.
- Create a new rule: module = Contact.
- On record action -> Create.
- Set condition as 'Lead Conversion Id' is not empty-> create new function.
- Edit arguments of the function and create 2 new arguments.
- Set name of argument as 'contactid' and select value from 'Contact' module and 'Contact Id' field.
- Set name of argument as 'leadConversionId' and select value from 'Contact' module and 'Lead Conversion Id' field.
Copy and paste the below code, save function, and workflow.
- resp = zoho.crm.searchRecords("Zoho Sign__Zoho Sign_Documents","(Zoho Sign__Lead:equals:" + leadConversionId + ")");
- if(resp.size() > 0)
- {
- zsID = resp.get(0).get("id");
- zscontact = Map();
- zscontact.put("Zoho Sign__Contact",contactId);
- //Lead that is converted to Contact is updated in the Zoho Sign Documents module
- info zoho.crm.updateRecord("Zoho Sign__Zoho Sign_Documents",zsID,zscontact);
- }