
Manual lead conversion in Zoho CRM is the single biggest bottleneck in most Indian sales teams’ pipelines. A qualified IndiaMart lead sits in the Leads module for 3 days waiting for someone to click “Convert” — and by then, the prospect has already bought from a competitor. This guide shows you exactly how to auto-convert leads in Zoho CRM using Deluge — with 5 complete, production-ready scripts that trigger automatically when a lead meets your qualification criteria, converting to Contact, Account, and Deal without a single manual click.
Every script in this guide is copy-paste ready. Every parameter is explained line-by-line. Every common error — including the dreaded ID_ALREADY_CONVERTED — has a handling pattern. Whether you are building your first Zoho CRM automation or adding lead conversion to an existing workflow, this is the only guide you need.

- Script 1 — Basic lead conversion with Deal creation
- Script 2 — Conditional conversion (Lead Score based)
- Script 3 — IndiaMart auto-convert with custom fields
- Script 4 — Convert + update deal with custom data
- Script 5 — Bulk conversion from a custom function
- Lead Conversion Mapping setup — prerequisite
- All zoho.crm.convertLead() parameters explained
- Response parsing — Contact, Account, Deal IDs
- 6 error codes and how to handle each
- Triggering via Workflow Rules vs Custom Functions
- Before You Start — Prerequisites
- Setting Up Lead Conversion Mapping
- zoho.crm.convertLead() — Every Parameter
- Script 1 — Basic Conversion + Deal Creation
- Script 2 — Score-Based Auto Conversion
- Script 3 — IndiaMart Lead Auto-Convert
- Script 4 — Convert + Update Deal Fields
- Script 5 — Bulk Conversion Custom Function
- Error Handling — 6 Common Errors Fixed
- 12 FAQs — Auto Convert Leads Zoho CRM
1. Before You Start — Prerequisites for Lead Auto-Conversion
Before writing a single line of Deluge to auto convert leads in Zoho CRM, three prerequisites must be in place. Skipping any of these is the most common reason lead conversion scripts fail silently.
The zoho.crm.convertLead() function and Custom Functions in Workflow Rules require Zoho CRM Professional (₹1,400/user/month) or Enterprise (₹2,400/user/month). The Standard plan does not support custom Deluge functions in Workflows. Confirm your plan at Setup → Subscription before building this automation.
Go to Setup → Leads → Lead Conversion. Every Lead field that should carry over to Contact, Account, or Deal must be mapped here before your script runs. Fields not in the mapping AND not passed in your Deluge script will be blank in the new records. Section 2 of this guide covers the full setup.
The Stage field you pass in the Deals map must exactly match the stage API name in your Zoho CRM pipeline — including capitalisation. To get the correct API names, go to Setup → Modules and Fields → Deals → Fields → Stage → Edit. Common defaults: “Qualification”, “Needs Analysis”, “Value Proposition” — but your CRM may have custom stages.
2. Setting Up Lead Conversion Mapping — The Foundation
Lead Conversion Mapping determines which fields on the Lead record automatically populate Contact, Account, and Deal records when you auto convert leads in Zoho CRM. Getting this right is what separates a clean conversion from one that creates empty Contact records and missing Account names.
How to Access Lead Conversion Mapping
Go to Zoho CRM → Setup (gear icon) → Leads → Lead Conversion. You will see three sections: Contacts, Accounts, and Deals. Each section shows your Lead fields on the left and the corresponding module field on the right. Drag Lead fields to the target module fields to create the mapping.
Recommended Minimum Mapping for Indian B2B Businesses
| Lead Field | Maps To | Module |
|---|---|---|
| First Name, Last Name | First Name, Last Name | Contacts |
| Contacts | ||
| Phone | Phone | Contacts |
| Company | Account Name | Accounts |
| Annual Revenue | Annual Revenue | Accounts |
| Lead Source | Lead Source | Contacts + Deals |
| Description | Description | Contacts |
3. zoho.crm.convertLead() — Every Parameter Explained
Before writing any script to auto convert leads in Zoho CRM using Deluge, understand every parameter the function accepts. The official documentation covers only 2 examples — this section covers every scenario you will actually encounter in production.
Full Syntax
response = zoho.crm.convertLead(lead_id, values_map, connection);
Parameter Reference — Complete
| Parameter | Type | Required | What to Pass |
|---|---|---|---|
| lead_id | NUMBER | Yes | The numeric Record ID of the Lead. Get from input.Id in a Workflow, or from searchRecords() response. |
| values_map | KEY-VALUE | Yes | Map with keys: “Deals” (Map of deal fields), “Accounts” (existing account ID), “Contacts” (existing contact ID), “overwrite” (bool). |
| connection | TEXT | Optional | Connection name for Zoho Creator or other non-CRM Deluge contexts. Not needed in CRM Workflow Custom Functions. |
| overwrite | BOOLEAN | Optional | Set true inside values_map to overwrite existing Account/Contact data with Lead data during conversion. Default is false. |
The Deals Sub-Map — Fields You Must Always Pass
| Deal Field API Name | Required | Format / Example |
|---|---|---|
| Deal_Name | Yes | “Acme Corp Deal” — typically built dynamically from lead data |
| Closing_Date | Yes | “2026-06-30” — YYYY-MM-DD format only. Use zoho.currentdate.addDays(30) for dynamic date. |
| Stage | Yes | “Qualification” — must exactly match API name of a stage in your pipeline |
| Amount | Optional | 50000 — numeric value, no currency symbol |
| Pipeline | Optional | “Standard” — only needed if you have multiple pipelines configured |
Response Format — What the Function Returns
// Successful conversion — all three records created { "Contacts": "5240000001234001", "Accounts": "5240000001234002", "Deals": "5240000001234003" } // Conversion without Deal (Deals key omitted from values_map) { "Contacts": "5240000001234001", "Accounts": "5240000001234002", "Deals": null } // Error — lead already converted { "code": "ID_ALREADY_CONVERTED", "message": "id already converted", "status": "error", "details": {} }
4. Script 1 — Basic Lead Conversion with Deal Creation
This is the foundational script to auto convert leads in Zoho CRM using Deluge. Use this as a Custom Function inside a Workflow Rule. The workflow fires when a lead meets your criteria — Lead Status changed to “Qualified” is the most common trigger.
Where to Add This Script
Zoho CRM → Setup → Automation → Workflow Rules → Create Rule → Module: Leads → Trigger: Field Update → Condition: Lead Status equals “Qualified” → Action: Custom Function → Write Function → Paste the script below.

// ================================================= // SCRIPT 1: Basic Auto Lead Conversion // Trigger: Workflow Rule on Lead record // Usage: Fires when Lead Status = "Qualified" // ================================================= // Step 1: Get the lead ID from the workflow trigger lead_id = input.Id; // Step 2: Get lead data to build Deal Name dynamically lead_data = zoho.crm.getRecordById("Leads", lead_id); lead_name = lead_data.get("Full_Name"); company = lead_data.get("Company"); // Step 3: Build the Deals sub-map // These fields CANNOT be set in Lead Conversion Mapping // They must always be passed explicitly here deal_map = Map(); deal_map.put("Deal_Name", company + " - " + lead_name); deal_map.put("Stage", "Qualification"); deal_map.put("Closing_Date", zoho.currentdate.addDays(30).toString("YYYY-MM-dd")); // Step 4: Build the main values map values_map = Map(); values_map.put("Deals", deal_map); // Step 5: Call the conversion function response = zoho.crm.convertLead(lead_id, values_map); // Step 6: Check for errors before processing response if(response.containsKey("code")) { info "Conversion error: " + response.get("message"); } else { // Step 7: Extract the new record IDs new_contact_id = response.get("Contacts"); new_account_id = response.get("Accounts"); new_deal_id = response.get("Deals"); info "Lead converted successfully"; info "Contact: " + new_contact_id; info "Account: " + new_account_id; info "Deal: " + new_deal_id; }
5. Script 2 — Score-Based Auto Conversion with Conditional Logic
This script adds conditional logic to auto convert leads in Zoho CRM based on Lead Score — converting only when a lead crosses your qualification threshold. It also handles the case where the lead is already converted.
// ================================================= // SCRIPT 2: Score-Based Conditional Lead Conversion // Trigger: Workflow Rule — Lead Score field updated // Converts only if score >= 80 AND not already converted // ================================================= lead_id = input.Id; lead_data = zoho.crm.getRecordById("Leads", lead_id); lead_score = lead_data.get("Lead_Score").toLong(); is_converted = lead_data.get("Converted"); // Only convert if score qualifies AND not already converted if(lead_score >= 80 && is_converted == false) { company = lead_data.get("Company"); lead_name = lead_data.get("Full_Name"); // Set Deal Stage based on Lead Score deal_stage = "Qualification"; if(lead_score >= 90) { deal_stage = "Needs Analysis"; } deal_map = Map(); deal_map.put("Deal_Name", company + " Deal"); deal_map.put("Stage", deal_stage); deal_map.put("Closing_Date", zoho.currentdate.addDays(45).toString("YYYY-MM-dd")); values_map = Map(); values_map.put("Deals", deal_map); response = zoho.crm.convertLead(lead_id, values_map); if(response.containsKey("code")) { info "Error: " + response.get("code") + " - " + response.get("message"); } else { info "High-score lead converted. Deal ID: " + response.get("Deals"); } } else if(is_converted == true) { info "Lead already converted — skipping"; } else { info "Score " + lead_score + " below threshold — not converting"; }
6. Script 3 — IndiaMart Lead Auto-Convert with Custom Fields
For Indian businesses using IndiaMart as a lead source, this script automatically converts every IndiaMart enquiry that has been followed up within 2 hours. It also passes custom fields that are specific to B2B manufacturing and trading businesses in India.
// ================================================= // SCRIPT 3: IndiaMart Lead Auto-Conversion // Trigger: Workflow Rule // Condition: Lead_Source = "IndiaMart" AND // Lead_Status = "Contacted" AND // First_Response_Time <= 2 hours // ================================================= lead_id = input.Id; lead_data = zoho.crm.getRecordById("Leads", lead_id); // Extract lead fields company = lead_data.get("Company"); product_req = lead_data.get("Description"); // IndiaMart enquiry subject lead_source = lead_data.get("Lead_Source"); is_converted = lead_data.get("Converted"); // Safety check — never try to convert an already-converted lead if(is_converted != true) { // Build Deal Name from IndiaMart enquiry context deal_name = company + " - IndiaMart Enquiry"; deal_map = Map(); deal_map.put("Deal_Name", deal_name); deal_map.put("Stage", "Qualification"); deal_map.put("Closing_Date", zoho.currentdate.addDays(30).toString("YYYY-MM-dd")); deal_map.put("Lead_Source", "IndiaMart"); deal_map.put("Description", "Product Requirement: " + product_req); // Optional: Set Deal Amount from lead if field exists est_value = lead_data.get("Annual_Revenue"); if(est_value != null && est_value != "") { deal_map.put("Amount", est_value); } values_map = Map(); values_map.put("Deals", deal_map); response = zoho.crm.convertLead(lead_id, values_map); if(response.containsKey("code")) { info "IndiaMart conversion failed: " + response.toString(); } else { deal_id = response.get("Deals"); // Add a note on the new Deal for context note_map = Map(); note_map.put("Parent_Id", deal_id); note_map.put("se_module", "Deals"); note_map.put("Note_Title", "Auto-converted from IndiaMart"); note_map.put("Note_Content", "This deal was auto-created from IndiaMart lead. Enquiry: " + product_req); zoho.crm.createRecord("Notes", note_map); info "IndiaMart lead converted. Deal ID: " + deal_id; } }
7. Script 4 — Convert Lead + Immediately Update Deal with Custom Fields
When you auto convert leads in Zoho CRM using Deluge, the Deal created during conversion may not have all the custom fields you need. This script converts the lead, captures the new Deal ID from the response, and immediately updates the Deal with additional custom field data — all in one function call.
// ================================================= // SCRIPT 4: Convert Lead + Update Deal Custom Fields // Use Case: Pass custom fields that can't go in // conversion mapping or deal_map // ================================================= lead_id = input.Id; lead_data = zoho.crm.getRecordById("Leads", lead_id); company = lead_data.get("Company"); is_converted = lead_data.get("Converted"); // Custom fields from the Lead record product_interest = lead_data.get("Product_Interest"); // Custom field territory = lead_data.get("Territory"); // Custom field budget_range = lead_data.get("Budget_Range"); // Custom field if(is_converted != true) { deal_map = Map(); deal_map.put("Deal_Name", company + " Deal"); deal_map.put("Stage", "Qualification"); deal_map.put("Closing_Date", zoho.currentdate.addDays(30).toString("YYYY-MM-dd")); values_map = Map(); values_map.put("Deals", deal_map); response = zoho.crm.convertLead(lead_id, values_map); if(!response.containsKey("code")) { new_deal_id = response.get("Deals"); new_contact_id = response.get("Contacts"); // Update the new Deal with custom fields from the Lead update_deal = Map(); update_deal.put("Product_Interest", product_interest); update_deal.put("Territory", territory); update_deal.put("Budget_Range", budget_range); zoho.crm.updateRecord("Deals", new_deal_id, update_deal); // Update Contact with additional context update_contact = Map(); update_contact.put("Lead_Source", lead_data.get("Lead_Source")); zoho.crm.updateRecord("Contacts", new_contact_id, update_contact); info "Converted and updated. Deal: " + new_deal_id; } }
8. Script 5 — Bulk Lead Conversion Standalone Function
This script is a standalone Scheduled Function that runs automatically every morning and bulk-converts all Qualified leads that have not yet been converted. Use this when you want daily batch conversion rather than real-time per-lead conversion.
// ================================================= // SCRIPT 5: Bulk Lead Conversion — Scheduled Function // Setup: CRM → Setup → Automation → Scheduled Actions // Frequency: Daily 9:00 AM // Converts all leads with Status="Qualified" and Converted=false // ================================================= // Search for all unconverted qualified leads search_criteria = "((Lead_Status:equals:Qualified))"; qualified_leads = zoho.crm.searchRecords("Leads", search_criteria, 1, 200); converted_count = 0; skipped_count = 0; error_count = 0; for each lead in qualified_leads { lead_id = lead.get("id"); is_converted = lead.get("Converted"); company = lead.get("Company"); // Skip already-converted leads (safety check) if(is_converted == true) { skipped_count = skipped_count + 1; continue; } // Build deal fields deal_map = Map(); deal_map.put("Deal_Name", company + " - Auto Converted"); deal_map.put("Stage", "Qualification"); deal_map.put("Closing_Date", zoho.currentdate.addDays(30).toString("YYYY-MM-dd")); values_map = Map(); values_map.put("Deals", deal_map); response = zoho.crm.convertLead(lead_id, values_map); if(response.containsKey("code")) { error_count = error_count + 1; info "Error on lead " + lead_id + ": " + response.get("code"); } else { converted_count = converted_count + 1; } } // Log the batch summary info "Bulk conversion complete. Converted: " + converted_count + " | Skipped (already converted): " + skipped_count + " | Errors: " + error_count;
9. Error Handling — 6 Common Errors When You Auto Convert Leads in Zoho CRM
These are the 6 most common errors encountered when building Deluge scripts to auto convert leads in Zoho CRM, what causes each one, and the exact code fix.

ID_ALREADY_CONVERTEDCause: Trying to convert a lead that was already converted — either manually by a user or by a previous workflow run. This is the most common error in production.
response = zoho.crm.convertLead(lead_id, values_map); if(response.containsKey("code") && response.get("code") == "ID_ALREADY_CONVERTED") { info "Lead already converted — no action needed"; // Optionally: update a custom field on the lead to flag this }
INVALID_DATACause: The lead_id passed to the function is null, empty, or not a valid Zoho CRM record ID. Happens when input.Id is not correctly fetched, or when the searchRecords() call returns no results and you try to use a null ID.
lead_id = input.Id; if(lead_id == null || lead_id == "") { info "No lead ID received — function exiting"; return; }
INVALID_MODULECause: The Stage value passed in deal_map does not match any stage in your Zoho CRM pipeline. Zoho CRM returns INVALID_MODULE when a picklist value does not match exactly (case-sensitive).
// Wrong — will fail if your stage is "Qualification" not "qualification" deal_map.put("Stage", "qualification"); // Correct — get exact API name from Setup → Modules → Deals → Fields → Stage deal_map.put("Stage", "Qualification");
MANDATORY_NOT_FOUNDCause: Deal_Name, Closing_Date, or Stage is missing from your deal_map. All three are mandatory when creating a Deal during conversion.
// Always ensure all 3 mandatory Deal fields are present deal_map = Map(); deal_map.put("Deal_Name", company + " Deal"); // MANDATORY deal_map.put("Stage", "Qualification"); // MANDATORY deal_map.put("Closing_Date", "2026-06-30"); // MANDATORY
INVALID_TOKEN (null response)Cause: Occurs in Zoho Creator or cross-app functions when the connection is not configured. In CRM Workflow Functions, this does not apply — but in Creator, you must add the connection parameter.
// In Zoho Creator — connection parameter is required response = zoho.crm.convertLead(lead_id, values_map, "zoho_crm_connection"); // In Zoho CRM Workflow — no connection needed response = zoho.crm.convertLead(lead_id, values_map);
Date format error (silent failure)Cause: Closing_Date passed in wrong format (DD-MM-YYYY or DD/MM/YYYY). Zoho CRM requires YYYY-MM-DD. This often fails silently — the conversion succeeds but the Deal has a blank or wrong Closing_Date.
// Wrong formats — will cause silent failure deal_map.put("Closing_Date", "30-06-2026"); // DD-MM-YYYY — wrong deal_map.put("Closing_Date", "30/06/2026"); // DD/MM/YYYY — wrong // Correct format — always YYYY-MM-DD deal_map.put("Closing_Date", "2026-06-30"); // YYYY-MM-DD — correct deal_map.put("Closing_Date", zoho.currentdate.addDays(30).toString("YYYY-MM-dd")); // dynamic — correct
Need Help Building Zoho CRM Automation?
Codroid Labs builds production-grade Zoho CRM Deluge automations for Indian businesses — IndiaMart lead flows, score-based conversion, custom field mapping, and full workflow design. Free consultation.
150+ implementations. Fixed price. Go-live in 2 weeks.
10. Auto Convert Leads Zoho CRM Deluge — 12 Questions Answered
What is the Deluge function to auto-convert leads in Zoho CRM?
The function is zoho.crm.convertLead(lead_id, values_map). It converts a Lead record into three new records — Contact, Account, and Deal — using the field mappings defined in your Lead Conversion Mapping configuration. The response returns the IDs of the newly created Contact, Account, and Deal records. Use this function inside a Workflow Rule Custom Function for per-lead automation, or in a Scheduled Function for batch daily conversion.
What fields must I pass when calling zoho.crm.convertLead()?
The minimum mandatory fields for Deal creation are: Deal_Name (text), Stage (must exactly match a pipeline stage API name), and Closing_Date (in YYYY-MM-DD format). Contact and Account fields are populated automatically from your Lead Conversion Mapping. If you want to convert without creating a Deal — only Contact and Account — omit the “Deals” key from the values_map entirely and the function will create Contact and Account only.
How do I trigger auto lead conversion using a Workflow Rule?
Go to Zoho CRM → Setup → Automation → Workflow Rules → Create Rule. Set Module to Leads. Set Trigger to “Field Update.” Add condition: Lead Status equals “Qualified” (or Lead Score greater than 80, or any criterion that defines a qualified lead for your business). In Actions, click “Custom Function” and write or paste your Deluge conversion script. The workflow fires automatically every time the trigger condition is met on any Lead record, 24/7, without any manual action.
How do I fix the ID_ALREADY_CONVERTED error in Deluge?
Check the “Converted” field on the Lead before calling convertLead(), or check the response for the error code: if(response.containsKey("code") && response.get("code") == "ID_ALREADY_CONVERTED") { info "Already converted"; }. The best practice is to add if(lead_data.get("Converted") != true) as the first check before attempting conversion — this prevents the API call entirely for already-converted leads.
Can I convert a lead to an existing Account instead of creating a new one?
Yes. Pass the existing Account’s record ID in the values_map: values_map.put("Accounts", existing_account_id);. The Lead will be associated with the existing Account instead of creating a duplicate. Also use values_map.put("overwrite", true) if you want the Lead data to overwrite the existing Account fields. Without overwrite:true, existing Account data is preserved and only new fields from the Lead are added.
How do I convert leads from IndiaMart automatically in Zoho CRM?
Set up the native IndiaMart-Zoho CRM integration (available in CRM → Setup → Marketplace → IndiaMart). Leads flow in automatically with Lead Source = “IndiaMart.” Create a Workflow Rule: Trigger on Lead creation, Condition: Lead Source = IndiaMart AND Lead Status = “Contacted.” Action: Custom Function calling zoho.crm.convertLead() with Stage = “Qualification” and Closing_Date = 30 days from today. Script 3 in this guide provides the complete production-ready IndiaMart conversion script.
Can I auto-convert leads in Zoho CRM without creating a Deal?
Yes. Simply omit the “Deals” key from the values_map: response = zoho.crm.convertLead(lead_id, Map()); or pass only Account/Contact IDs if associating with existing records. The response will have Deals: null, and only Contact and Account records are created. Use this pattern when your sales process does not create a formal Deal opportunity at the time of initial contact.
What is Lead Conversion Mapping and why does it matter?
Lead Conversion Mapping (Setup → Leads → Lead Conversion) defines which Lead fields automatically carry over to Contact, Account, and Deal records during conversion. Fields not in this mapping AND not passed in your Deluge script will be blank in the new records. This is the most common cause of incomplete conversions — developers write the Deluge script but forget to configure the mapping, so Contact records are created without phone numbers, emails, or other data that was on the Lead.
How do I update the new Deal with custom fields after conversion?
Capture the new Deal ID from the conversion response, then call zoho.crm.updateRecord: new_deal_id = response.get("Deals"); update_map = Map(); update_map.put("Custom_Field", value); zoho.crm.updateRecord("Deals", new_deal_id, update_map);. Script 4 in this guide provides a complete example of converting a lead and immediately updating both the Deal and Contact with custom field data from the original Lead record.
Does zoho.crm.convertLead() work in Zoho Creator?
Yes, but you must add the connection parameter. In Zoho Creator, first create a CRM Connection (Creator → Settings → Connections → Add Connection → Zoho CRM) with modules.all permissions. Then call: response = zoho.crm.convertLead(lead_id, values_map, "your_connection_name");. Without the connection parameter in Creator, the function returns a null response or authentication error. In CRM Workflow Custom Functions, the connection parameter is not needed.
How do I get the correct Stage API name for the Deal?
Go to Zoho CRM → Setup → Modules and Fields → Deals → Fields → Stage → click Edit. You will see the list of all stage values — these are the exact strings you must use in your Deluge script. Common defaults: “Qualification”, “Needs Analysis”, “Value Proposition”, “Id. Decision Makers”, “Perception Analysis”, “Proposal/Price Quote”, “Negotiation/Review”, “Closed Won”, “Closed Lost”. If your pipeline has custom stages, they will appear here with their exact API-compatible names.
Can I convert leads based on lead score automatically?
Yes. Set up Zoho CRM Lead Scoring first (Setup → Leads → Lead Scoring) to auto-score leads based on email opens, page visits, form fills, and demographics. Then create a Workflow Rule with trigger: Lead Score field updated, Condition: Lead Score greater than or equal to 80, Action: Custom Function with your conversion script. Script 2 in this guide shows complete score-based conditional conversion with different Deal Stages assigned based on whether the score is 80-89 (Qualification stage) or 90+ (Needs Analysis stage).
