Requirement Overview
Sending an Email notification to the customer when a sales agent converts their lead record to a contact record in Zoho CRM. This email will allow the customer to be aware of the benefits they can receive as a contact.
Use case
When a potential lead expresses interest in a product or service, the sales team nurtures the relationship until the lead is qualified and ready to be converted into a contact. At this critical transition point, sending an automated email notification serves as a formal acknowledgement of the customer’s progression in the sales journey.
This communication reassures the customer that their interest has been recognized, introduces them to the next stage of engagement, highlights benefits received as a contact, and sets clear expectations for future interactions. It also helps establish trust, maintain engagement, and ensure a seamless handover from pre-sales to post-conversion activities, ultimately enhancing the overall customer experience and increasing the likelihood of successful conversion and long-term retention.
Permission & Availability
-> Users with the Manage Extensibility permission can create connections and write custom functions.
-> Users with the Manage Automation permission can configure Workflow Rules.
-> Users with the Manage Sandbox permission can manage the sandbox and test this use case.
Solution
To achieve this requirement in Zoho CRM, the solution leverages a combination of workflow automation and a custom function to ensure that an email notification is sent precisely when a lead is converted into a contact. When a lead conversion occurs, the system captures the newly created contact record and retrieves the necessary details required for communication.
Since the workflow alone may not always provide direct access to all related data from the converted record, the custom function plays a crucial role in fetching the contact information dynamically and ensuring accuracy in the email communication. Once triggered, the custom function processes the converted record details and initiates the email notification using predefined templates or parameters.
By combining workflow rules with a custom function, this solution ensures a seamless and automated transition in customer communication during lead conversion. It enhances operational efficiency by reducing manual intervention, minimizes the risk of missed follow-ups, and delivers a more professional and responsive experience to customers at a critical stage in their journey.
A) Configuration: Custom function - Step-by-Step Implementation Guide
1. Workflow Rule configuration:
Navigate to Settings (⚙️) in Zoho CRM → Automation > Workflow rules > Create rule.
Select the Contact module and give a name along with the description for your workflow.
A) When: Select Record Action >> Create
B) Condition: All Contacts
C) Instant Actions: Select Function >> Write your own function
2. Create a Connection:
- Navigate to Setup >> Developer Hub >> Connections >> My Connection >> Create Connection
- Select "Zoho CRM" as the service and provide a name to "Connection."
- Then, select the below scope:
scope= ZohoCRM.modules.ALL (or) ZohoCRM.modules.{module_name}.{operation_type} 3. Script:
- //Getting the contact record for which workflow got triggered
- Converted_Lead = invokeurl
- [
- url :"https://www.zohoapis.com/crm/v8/Contacts/" + Contact
- type :GET
- connection:"crmconnection2"
- ];
- //Using the Data_Source param, checking if fetched contact is a converted lead or not
- Check = Converted_Lead.get("data").get(0).get("Data_Source");
- //Using if condition to send the email only to the converted lead
- if(Check = "Converted")
- {
- //Sending an email
- sendmail
- [
- from : zoho.loginuserid
- to : Contactemail
- subject: "Lead convert"
- message : "<div>Hi there,<br></div><div><br></div><div>We’re delighted to inform you that your interest in our products/services has been successfully recognized, and you have now moved to the next stage of engagement with us.<br></div><div><br></div><div>Should you have any questions or require further information, please feel free to reach out to us at any time.<br></div><div><br></div><div>Thank you.<br></div>"
- ]
- }
Notes: In the API URL, kindly change the domain as per your DC.
4. Field Argument Mapping in Deluge Setup:
Argument 1: Contact (Line no. 4) = map this variable with the Contact ID
Argument 2: Contactemail (Line no. 17) = Map this variable with the Contact's email address

Use the correct API names for both modules & fields in the script.
While writing the script, it is suggested to add info() logs to each variable to check the output for seamless functionality under the Console section within the Zoho CRM Function IDE.
Use the optimized code in the custom function to avoid facing limitations related to statement execution or execution time limits. Refer to Deluge Limitations for more information.
When you need to use Connections within a function script, be sure to have the required scopes added in the connection to perform the intended API action. Also, be sure to use the connection link name (i.e., crm_connection) while passing it to the Deluge Invoke URL or Integration Task.
When you use the get() method in a Deluge function, try using an ifNull() conditional statement to avoid any errors that say "get value is null" and stop execution immediately. When you associate a function with any automation (e.g., workflow rules), and if such an error occurred, it would stop function execution for the respective record. Help LINK to know more about the ifNull statement.
In case the associated function is not executed in the respective record via the Automation Feature (e.g., Workflow Rules), then check the failure reason under "Setup >> Developer Hub >> Functions >> Failures."
Notes: Visit the Help Link to understand Common Deluge Error Messages that may occur during Custom Function execution.
Learn How to Optimize the Code
Limit Logging in Production: When a user adds too many info() logs, it may slow down execution. While testing, add info() logs to each variable, and once tested, comment on the non-required info() logs. i.e., use conditional logging only for debugging purposes.
Use Try-Catch Blocks: Use try-catch blocks to handle exceptions smartly without wrapping every line in a try. Log the required error messages that help trace the exact issue with the line of code. Refer to the following Help Link to know the syntax & sample code. Notes: To ensure a smooth implementation, we recommend configuring and testing the setup in the sandbox environment before deploying it to production.
If you prefer not use custom function to achieve this requirement, you could follow the method outlined below. This approach is different from using custom function, however the end result would be the same.
B) Configuration: Native Options - Step-by-Step Implementation Guide
1. Custom Checkbox field
A) Adding field:
Create a custom checkbox field in both the Leads and Contacts modules. Rename the field in each module as required.
Navigate to Settings (⚙️) in Zoho CRM → Customization → Modules and Fields → Select the module → Select the layout → Add a custom checkbox field
In the Leads module, the checkbox field value will be updated via workflow when a Lead is created.
In the Contact module, the checkbox field value will be used as a criteria to trigger an email notification.
B) Field permission:
As the checkbox is going to be updated automatically via workflow, we can set the field permission as 'Dont Show' for all profiles. Doing this will hide the field from the users within the module.
C) Lead Conversion Mapping:
After creating the custom checkbox field in both modules, configure field mapping to ensure the value is carried over during lead conversion. This allows the value from the Lead’s checkbox field to be updated in the corresponding Contact field.
For example, if the checkbox field in the Leads module is enabled, the corresponding field in the Contacts module will also be enabled after conversion.
Navigate to Settings (⚙️) in Zoho CRM → Customization → Modules and Fields → Lead modules → Lead conversion mapping → Map the fields in the Lead and Contact modules.
Note: Configuring Lead Conversion mapping is an important step in this method, as it ensures that field values are accurately transferred during lead conversion.
2. Email template
Create an email template that will be sent to the customer when a lead record is converted into a contact record.
Navigate to Settings (⚙️) in Zoho CRM → Customization → Templates → Email
3. Workflow configuration
Create two workflows: one for the Leads module and another for the Contacts module.
A) Workflow for Leads module:
This workflow is triggered when a lead is created. Set the workflow trigger as "Record Creation" and select "All Leads." So that it is executed for all lead records. Then, add a field update action. In the field update action, configure it to set the Custom Checkbox field to "selected."
B) Workflow for Contact:
Configure the workflow with the trigger set to “Record Creation” and define the criteria as “Checkbox field is selected.” This ensures that the workflow is triggered only for records where the checkbox is enabled. Then, add an Email Notification action and select the template created earlier.
Output:
Custom Solution Created by Harish K | Zoho Partner Support