Zoho CRM guide

Deluge scripts for Zoho CRM: 10 practical examples

10 practical Deluge scripts for Zoho CRM: fetch and update records, create tasks, call APIs, derive state from GSTIN, dedupe by phone and more, with comments.

A consultant replies within 1 business day

Partner of the Year 2026Premium Partner of the Year 2025Zoho CRM Solutions Partner 2024

0110 yearsin Indian enterprise operations
02200+companies served
0318+BFSI institutions
046–10 weekstypical go live
TL;DRDeluge is Zoho's scripting language for custom logic across Zoho apps. In Zoho CRM you use it in custom functions (triggered by workflows, Blueprint or buttons) to read and update records, call external APIs and enforce rules the no code tools can't. Below are 10 practical patterns.

Key takeaways

  • Deluge runs inside Zoho CRM custom functions, triggered by workflows, Blueprint transitions or buttons.
  • The 10 examples below cover reading and updating records, tasks, Indian GST and phone handling, duplicates, external APIs and lead conversion.
  • Field API names differ between organisations. Replace the names in these snippets with yours.
  • Test every script in a Sandbox before it touches production data.
  • Zoho lists custom functions in the Enterprise edition and above.

Before you copy anything: these snippets are starting patterns. Change the module and field names to match your CRM, and run each one in a Sandbox first.

1. Fetch a record and read fields

Use it to start any function that needs data from the record that triggered it.

lead = zoho.crm.getRecordById("Leads", leadId);
email = lead.get("Email");
phone = lead.get("Phone");
info email;

Where to attach it: a workflow rule on lead create or edit.

2. Update a record

updateMap = Map();
updateMap.put("Stage", "Negotiation/Review");
resp = zoho.crm.updateRecord("Deals", dealId, updateMap);
info resp;

Where to attach it: a button or a Blueprint transition.

3. Create a follow up task

task = Map();
task.put("Subject", "Follow up on quote");
task.put("Due_Date", today.addDay(2));
task.put("What_Id", dealId);
task.put("$se_module", "Deals");
zoho.crm.createRecord("Tasks", task);

Where to attach it: a workflow on quote sent.

4. Derive the state code from a GSTIN (place of supply)

The first two digits of a GSTIN are the state code. This copies them to a field you can use on quotes.

acc = zoho.crm.getRecordById("Accounts", accountId);
gstin = ifnull(acc.get("GSTIN"), "");
if(gstin.length() == 15)
{
    stateCode = gstin.subString(0, 2);
    zoho.crm.updateRecord("Accounts", accountId, {"GST_State_Code": stateCode});
}

Where to attach it: a workflow on account create or when the GSTIN field changes.

5. Validate the GSTIN format

A GSTIN has 15 characters: 2 digits for the state, the 10 character PAN, an entity number, the letter Z, and a check character.

isValid = gstin.matches("[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]");

Where to attach it: the same function as example 4, before you save the state code. This checks the format only; it does not confirm the GSTIN is registered.

6. Normalise an Indian mobile number to +91

digits = phone.getAlphaNumeric().right(10);
normalised = "+91" + digits;

Where to attach it: a workflow on lead and contact create, so WhatsApp and IVR tools match records.

7. Find duplicates by phone before creating a lead

existing = zoho.crm.searchRecords("Leads", "(Phone:equals:" + normalised + ")");
if(existing.size() > 0)
{
    info "Duplicate: " + existing.get(0).get("id");
}

Where to attach it: a function that runs on incoming leads from forms and portals, before the lead is saved.

8. Call an external API with invokeurl

This example checks stock in an ERP.

headers = Map();
headers.put("Authorization", "Bearer " + apiToken);
response = invokeurl
[
    url :"https://erp.example.com/api/stock?sku=" + sku
    type :GET
    headers:headers
];
stock = response.get("available_qty");

Where to attach it: a button on the deal or quote. Keep the token in a Connection rather than in the script (see the rules below).

9. Convert a qualified lead into contact, account and deal

dealMap = Map();
dealMap.put("Deal_Name", leadCompany + " – New opportunity");
dealMap.put("Closing_Date", today.addDay(30));
dealMap.put("Stage", "Qualification");
convertMap = Map();
convertMap.put("Deals", dealMap);
resp = zoho.crm.convertLead(leadId, convertMap);
info resp;

Where to attach it: the "Qualify" transition in a Blueprint, so conversion happens only after the mandatory fields are filled. See Zoho CRM Blueprint examples.

10. Send a WhatsApp or SMS message through a provider webhook

The pattern is the same invokeurl call, with a POST and a JSON body. Replace the URL and parameters with the ones from your messaging provider's documentation.

payload = Map();
payload.put("to", normalised);
payload.put("template", "quote_follow_up");
resp = invokeurl
[
    url :"https://api.provider.example/v1/messages"
    type :POST
    parameters:payload.toString()
    headers:headers
];
info resp;

Where to attach it: a workflow on stage change. For the full WhatsApp setup, see Zoho CRM WhatsApp integration.

Deluge rules from our code reviews

  • Null check every get with ifnull.
  • Never hard code tokens; use Connections.
  • Log with info in the Sandbox only.
  • Keep one function per job.
  • Document API names in a comment header.

Need a developer?

If this list is longer than your team's capacity, see hiring Zoho CRM developers or the wider Zoho developer service. For no code and low code options first, start with Zoho CRM customization.

FAQ

Frequently asked questions

What is Deluge in Zoho?

Zoho's scripting language for custom functions and automation across Zoho apps.

Which edition allows custom functions?

Zoho lists custom functions in Enterprise and above.

Where do I test Deluge safely?

In Zoho CRM's Sandbox, before deploying to production.

Written by the Fristine Zoho CRM team, Zoho CRM Certified Consultants · Reviewed by Paras Shah, CTO · Last updated 1 December 2026

Bring us one sales process that isn’t working.

In 90 minutes we map it, show how it would run in Zoho CRM, and give you a fixed quote for the first phase. A consultant replies within 1 business day.

Get the free 45 point CRM audit

Talk to a Zoho CRM consultant

Tell us the process you want to fix. A consultant replies within 1 business day.