CRM Platforms · 5 min read

Zoho Deluge Examples: 6 Automations Worth Copying

Zoho Deluge examples for CRM: six short scripts for duplicate checks, task creation, Slack alerts and API calls, plus the mistakes that break them.

Zoho Deluge Examples: 6 Automations Worth Copying

Key takeaways

  • Most useful Deluge scripts are under 20 lines: a trigger, a lookup, one decision and one action.
  • Write the script for the failure case first. Empty fields, null lookups and API errors break more automations than logic mistakes do.
  • If Blueprint, a workflow rule or Zoho Flow can do the job without code, use them. Deluge is for what they can't reach.

A sales manager asks for one small thing: when a deal moves to Proposal, create a follow-up task for the owner and ping the channel. Blueprint can’t quite do it. Zapier would add another tool and another bill.

That’s the gap Deluge fills. It’s Zoho’s scripting language, and it’s readable enough that an ops person can learn it in a weekend. Below are six Zoho Deluge examples we’d actually put into a CRM, with the pitfalls that bite people later.

When to reach for Deluge (and when not to)

Try the no-code options first. Workflow rules, Blueprint and Zoho Flow cover a lot, and they’re easier for the next admin to understand.

Use a custom function when you need to:

  • Look at related records before deciding what to do.
  • Do something conditional that a workflow rule can’t express.
  • Call an outside API or send a structured message.
  • Run logic on a schedule across many records.
Triggerworkflow, Blueprint, button, schedule Function runsread, decide Actionupdate, create, notify, call API

Example 1: Create a follow-up task when a deal stage changes

The simplest and most used pattern. Attach this function to a workflow rule on the Deals module, with the deal ID passed in as an argument.

deal = zoho.crm.getRecordById("Deals", dealId);
owner = deal.get("Owner").get("id");
taskMap = Map();
taskMap.put("Subject", "Send proposal recap to " + deal.get("Deal_Name"));
taskMap.put("Due_Date", zoho.currentdate.addDay(2));
taskMap.put("Owner", owner);
taskMap.put("What_Id", dealId);
taskMap.put("$se_module", "Deals");
zoho.crm.createRecord("Tasks", taskMap);

Two days is arbitrary. Pick the follow-up window your team already agrees on, then make it the rule.

Example 2: Block duplicate leads before they pile up

Native duplicate checks catch exact matches. A function can catch near-matches, like the same email domain plus the same company name. Search first, then decide.

results = zoho.crm.searchRecords("Leads", "(Email:equals:" + email + ")");
if(results.size() > 0)
{
    info "Duplicate found: " + results.get(0).get("id");
}

Run it as a “before save” check or on a schedule, and log matches before you merge anything. We’d never auto-delete on a script’s judgement. If duplicates are a bigger problem for you, our CRM data hygiene checklist covers the process side.

Example 3: Send a Slack alert for high-value deals

An outbound call to a webhook is a few lines with invokeurl.

payload = Map();
payload.put("text", "New deal over threshold: " + dealName + " (" + amount + ")");
invokeurl
[
    url :"https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
    type :POST
    parameters:payload.toString()
];

Store the webhook URL as a connection or a custom variable rather than pasting it into the script. Anyone who can read the function can read the secret.

Got a Zoho automation that's half built or half broken?

Book a free 30-minute consultation. We'll review your current setup and show you how a few well-placed Deluge functions would work for your team.

See Zoho services

This one is about defence. Many scripts die on null because a lookup field was empty.

deal = zoho.crm.getRecordById("Deals", dealId);
acct = deal.get("Account_Name");
if(acct != null && acct.get("id") != null)
{
    upd = Map();
    upd.put("Rating", "Hot");
    zoho.crm.updateRecord("Accounts", acct.get("id"), upd);
}

The if is the whole point. Real data has gaps. Write for that.

Example 5: Flag stale deals on a schedule

Scheduled functions are underused. This pattern finds open deals nobody has touched and tags them for review.

Search

Fetch open deals with a last-activity date older than your threshold.

Loop

For each deal, set a field such as "Needs review" to true.

Notify

Send the owner one digest, not one email per deal.

Mind the limits. Zoho caps API calls and function execution time, and the numbers depend on your edition and change over time, so check the current limits in Zoho’s documentation before you loop over thousands of records. For big jobs, process in batches.

Example 6: Push a closed-won deal to another system

When a deal closes, you often need a customer record somewhere else: billing, a portal, a data warehouse. Build the payload, post it, and log the response.

resp = invokeurl
[
    url :"https://api.example.com/customers"
    type :POST
    parameters:payload.toString()
    headers:{"Content-Type":"application/json"}
];
info resp;

Always read and log the response. A function that fires and forgets will fail silently for weeks. If this touches a finance tool, test on a sandbox first.

How to test a function safely

Don’t test on live deals. Copy a handful of records into a sandbox or create obvious test records, like “ZZ Test Deal”, and run the function against those first.

Use info statements to print values as the script runs, then check the execution log. When it behaves on clean data, run it again on a record with empty fields and an odd owner. That second run finds most of the bugs.

Keep a short note for each function: what triggers it, what it changes and who owns it. It takes two minutes and saves an afternoon of guessing later.

Mistakes that break Deluge automations

Before you switch a function on

  • Every lookup and field read handles null.
  • Secrets live in connections, not in the script.
  • Failures send an email or write a log entry.
  • You tested with a record that has missing data.
  • Someone other than the author can explain what it does.

Also watch for recursion. A function that updates a record can re-trigger the workflow that called it. Add a guard field or a condition so it runs once.

And name things well. fn_deal_stage_task beats Function 3. Six months from now, you won’t remember.

Where this fits in a bigger Zoho setup

Deluge is the glue. It works best inside a clear structure: clean modules, a sensible Blueprint, and a known list of integrations. If you’re also deciding what to build in Creator, see our post on Zoho Creator use cases. If you’re rolling out the full suite, Zoho One implementation covers the order to do it in.

Some of what used to need code is also moving into Zoho Zia agents, so check whether a built-in option covers your case before you write anything.

The bottom line

Good Deluge is short, defensive and boring. Start with one pain point, write the failure case first, and log everything. When you’re stuck, or the automation touches revenue data, book the free consultation and we’ll look at it with you.

Want this working for your team?

Book a free 30-minute consultation. We’ll review your current setup and use cases, show you how it would work for you, and leave you with a recommended plan.

See Zoho services

FAQ

Questions, answered

Something else? Ask us directly.

What is Deluge in Zoho?

Deluge is Zoho's scripting language for custom logic. You use it in Zoho CRM custom functions, Zoho Creator, Zoho Books and other Zoho apps to read records, make decisions, call APIs and send messages.

Where do I write Deluge scripts in Zoho CRM?

In Setup, under Developer Space, then Functions. You write the function there and attach it to a workflow rule, Blueprint transition, button or schedule.

Do I need a developer to write Deluge?

Not for simple scripts. If you can read an if statement, you can adapt most of the examples below. Get help when the script touches money, bulk updates or external systems, because mistakes there are expensive.

Next step

Pick one workflow. We’ll have an agent running it in weeks.

Book a 30-minute call. We’ll map your highest-leverage use case, show a working agent and tell you honestly what it would take.

Book a demo