Zoho Crm: How to convert a Lead into a Potential using Custom function

Nov 11 2014

Lead To Potential Conversion

Objective is to convert Lead to Potential in Zoho CRM. Here our key module is Lead. A workflow must be created in order to convert a Lead to a Potential.


Login your account -> Setup -> Automation -> Workflow -> Create Rule


We should follow below steps for creating a Rule.

Step1:- Enter Basic Information

Module Field: We should choose Lead as an option here since we have to convert Lead to Potentials

Rule Name: User can type in any name of their choice

Status: Click “Is active” if you wish to activate the created rule

Description: Description of your choice.

Kindly refer to following visual.

Module Name


Rule Name





leads to potential conversion based on field action

Basic information

Step 2:- Rule Trigger

Rule Trigger option deals with the execution of workflow on following conditions.

  1. On Record action

  2. A Date field value

Rule trigger

On Record Action:- It has different options which are related to an action performed on the key module i.e. “Leads” in our case. Possible options are: execute the workflow when a new record is created, existing record is edited, record is deleted, field updated under LEADS Module. Below is the visual for the same


A Date field value:-  This rule is triggered based on date field selected, which are present on the Lead form. Upon selecting a date field, it further provides options like date of execution, time of execution, execution cycle


choose condition in execute based on option

Execute to based on

On Record action

A Date field Value

Step 3:-Rule Criteria

This step specifies that rule will be executed on the specified date and time for those Leads that match the following rule criteria.

It has three columns i.e. Field, condition, text box

Field: It contains all the fields of Lead module

Condition: It contains conditions like is, isn’t, contains, doesn’t contain, contains user

Text Box: Whatever selected from first two columns, appropriate results will be populated in to this column. If not selected automatically, can be entered manually as well.

Here is the visual.


Field Name


Field Value


Step 4:- Action

Action has different options under it.  In our case we’ve used custom function to map Lead fields to Potential fields using Delgue Script.

Following actions can be performed

Send Alert

Send Alert Message Through Email Template

Assign Task

Assign Task

Update Field

Action execute on particular fields are updated in corresponding module

Call Custom Function

We can call a custom function for a conversion and this function is written in Delgue Script


Time Based Action

It is applicable for time based actions only. User can create their own time based action


How to write Custom Function For Leads To Potentials Conversion?

Please follow these steps for writing a custom function which can be used to convert Leads to Potential

Call custom function(0)->Write your own

Step 1:- Write Function Name and click on EDIT for entering argument. Take lead Id as an argument.

Step 2:- Convert Lead Id into String using toString() function

Step 3:-Use searchRecordsByPDC function for searching leads using Lead Id

Step 4:-Create a map function and store it in a state variable

Step 5:-Use “foreach element as element loop”

Step 6:-Use Put key in Maplist to map Potential Fields with Lead Fields. Put key is used inside the loop

Step 7:-Use zoho.crm.create function to create a potential



function 1.3