AI writes Deluge — Zoho CRM's scripting language — fluently. That is the problem. The code reads like it works, passes a quick look, and then fails in the places Deluge is unforgiving about: silent limits, search that returns nothing, and syntax that looks standard in every other language.
I have worked on Zoho implementations for 24 companies (including team engagements), with around 680 Deluge functions running in production. These are the five checks I run on any AI-generated Deluge before it goes near production. They are the code-level counterpart to the human approval layer I built over AI-generated drafts in Zoho CRM: that article was about stopping bad output; this one is about the code underneath.
1. Search is the wrong default. Use COQL.
AI reaches for the Search API first because it looks like the obvious API. In Zoho CRM v8 it is the weaker one. COQL is Zoho's query language for CRM records, sent to the Query API:
| Search API | COQL | |
|---|---|---|
| Records per call | 200 per page | up to 2,000 |
| Total per query | 2,000 | 100,000 under the same conditions |
| Conditions | up to 10 | up to 25 |
| A record created a moment ago | may not appear yet (index lag) | no delay |
| Aggregates, sorting, subqueries, lookups across modules | not available | available |
Search runs through an index, so a record created or updated a moment ago may not show up yet. In one billing flow, an invoice took about 94 seconds to appear in Search results (measured 2026-11-02), and the unpaid amount stayed wrong until it did. COQL has no such delay.
The Deluge-side pattern for COQL is a Map with one key:
queryMap = Map();
queryMap.put("select_query", "select id, Last_Name from Leads where Email is not null limit 200");
response = invokeurl
[
url : "https://www.zohoapis.com/crm/v8/coql"
type : POST
parameters : queryMap.toString()
connection : "crm_coql"
];
The rule is simple: if you know the ID, fetch by ID. For anything else, use COQL. The figures above are from Zoho's Search Records and COQL documentation for API v8.
2. Deluge has no while loop. Or ternary. Or sleep.
Code that an AI model writes from general programming habits will not save:
- There is no
whilein Deluge. Onlyfor each, withbreakto exit. - There is no ternary operator
?:. Use if-else. - There is no
sleep(),getType(),instanceof,isList(), orjoin(). For repeating a character, useleftPad. For the type of a value, check whethertoString()starts with[. - A comment at the end of a line, or inside an
invokeurlblock (Deluge's built-in HTTP call), is a save error. Put comments on their own line above the code.
None of this is a matter of style. The editor refuses to save the function, and the error message rarely points at the real line.

3. Know the execution limits before you design around them
In v8, a function triggered from a button or an API call gets 10 seconds. Automation (workflow, Blueprint, approval) gets 30 seconds. A scheduled function gets 15 minutes. One execution is limited to 200,000 statements, including loops and functions it calls. Zoho publishes these in its function limits and quotas.
API credits — Zoho's unit for API usage — changed with v8 as well: usage is counted in credits over a rolling 24 hours, not as a simple per-user request count.
| Edition | Credits per rolling 24 hours |
|---|---|
| Free | 5,000 |
| Standard | 50,000 + 250 per licence, capped at 100,000 |
| Professional | 50,000 + 500 per licence, capped at 3,000,000 |
| Enterprise / Zoho One | 50,000 + 1,000 per licence, capped at 5,000,000 |
COQL costs 1 to 3 credits depending on the limit you set, and heavy APIs share a sub-concurrency cap of 10 across all editions. The full table is in Zoho's API limits for v8.
Designs that ignore these numbers work in a Sandbox — a test copy of your CRM — and time out in production, where the data is bigger. Designing around the limits is most of the work in a build like the round-robin lead assignment function I wrote in Deluge.
4. Compare text as text and it will bite you
Two failures I have seen in real projects, stated here as field observations rather than documented behaviour:
- Comparing two TEXT values with
<or>fails on save. Dates that come back from the API as"2026-08-05"are TEXT too. Convert first with.toDate(),.toLong()or.toDecimal().
Chaining .get() twice fails the same way
Chaining .get() twice, as in a.get("b").get("c"), fails to save, and the error points at an unrelated line. Assign the middle value to a variable first:
// Fails to save:
city = response.get("data").get("City");
// Assign the middle value first:
data = response.get("data");
city = data.get("City");
5. Subform updates: an empty array deletes every row
Also a field observation, and the one to treat with the most care: when you update a subform (a repeating table of rows inside a record), rows you do not include stay unchanged — but sending an empty array deletes every row. Verify this in a Sandbox against your own data before relying on it, because the cost of getting it wrong is data loss, not an error message.
The checklist
- COQL, not Search, for any conditional fetch
- No
while, no ternary, nosleep, nogetType - Button 10 seconds, automation 30 seconds, schedule 15 minutes
- Convert TEXT before comparing it; assign the middle value before chaining
.get() - Never send an empty subform array without checking what it deletes
The point is not that AI is bad at Deluge. The point is that Deluge fails quietly, and quiet failures are the ones that reach production.
FAQ
Can ChatGPT or Claude write Zoho Deluge code?
Yes — fluently, and that is exactly the risk. The output reads like working code, but models write from general programming habits: they reach for the Search API, use loops and operators Deluge does not have, and ignore execution limits. Treat generated Deluge like code from a new hire: run the checks in this article before it goes near production.
Why does a record I just created not appear in Zoho CRM search results?
The Search API runs through an index, and the index lags. In one billing flow I measured about 94 seconds before a new invoice appeared, and any calculation based on search results is wrong until it does. If you know the record ID, fetch it by ID; for anything conditional, use COQL, which has no index delay.
How long can a Deluge function run in Zoho CRM?
In v8: 10 seconds for a function triggered by a button or an API call, 30 seconds for automation such as workflows and Blueprints, and 15 minutes for a scheduled function. One execution is also capped at 200,000 statements, including the statements of any function it calls.
What happens if I update a subform with an empty list?
Every row in the subform is deleted. Rows you simply leave out are kept; an explicitly empty array is not. Guard the empty case in code, and test subform updates in a Sandbox before production.
I build Zoho CRM customizations and integrations — requirements, Deluge development, API work, and rollout support. If AI-generated Deluge is heading into your production org and you want it checked before it ships, message me on LinkedIn — that is the kind of work I do.
