Book a Meeting

Zoho Creator and Deluge · Syntax reference

Deluge cheatsheet: Zoho's scripting syntax on one page

Short answer: Deluge is the scripting language you write inside Zoho CRM, Creator, Books, Desk and many sibling Zoho products. Statements end with a semicolon, variables need no declaration, text sits in double quotes, dates in single quotes, and the only loop is for each. Collections are lists {"a","b"} and maps Map(). Below you get each construct with a short example you can copy, the mistakes that waste an afternoon, and which construct to reach for in a given job.

We reply within 1 business hour · No obligation

300+
Zoho projects delivered
2021
Scripting Zoho in Deluge since
3 offices
Bangalore, Coimbatore, Kochi
ZohoAdvancedPartner

Also Zoho Creator Registered, Zoho Catalyst, AWS and Shopify Partner

What are the ground rules of Deluge syntax?

Every statement ends with a semicolon, blocks sit inside curly braces, and a variable comes into being the first time you assign it. Deluge works out the type from the value, so qty = 12; is a number and city = "Mysuru"; is text.

  • Comments. // one line or /* several lines */. Leave a comment above any block that touches money or tax, so whoever inherits the script knows why it exists.
  • Quotes carry meaning. Double quotes make text. Single quotes make a date or date-time, such as '01-Apr-2026'. Swapping them is the most common first-week error.
  • Null checks. isNull(x) and x.isEmpty() answer different questions: the first asks whether a value exists at all, the second whether a text, list or map holds nothing. ifnull(x, "fallback") returns the fallback when x is null.
  • Output while testing. info x; prints to the editor's output pane or the function log. Remove or reduce it before go-live so logs stay readable.
  • Return. A function ends with return value; when its return type is anything other than void.

Zoho keeps the full language reference in its Deluge help centre. This page is the short version we pin next to the editor during client work.

Type to filter

Which Deluge functions do you need for text, numbers, lists, maps and dates?

The five tables below hold the built-in functions our developers type most days. Type a word such as "date" or "split" into the box to narrow every table at once; without JavaScript all rows stay visible.

Text
WriteGives you
s.length()Number of characters
s.trim()Text without spaces at either end, handy on web form input
s.toUpperCase()Capitals, useful before saving a PAN or GSTIN
s.contains("Pvt")true or false
s.startsWith("29")true when the text begins with those characters
s.subString(2, 12)Characters from position 2 up to, not including, 12 (counting starts at 0)
s.replaceAll("[^0-9]", "")Text with every match removed; the search is read as a pattern
s.toList(",")A list split at each comma
s.matches("[0-9]{6}")true when the whole text fits the pattern, such as a six-digit PIN code
s.toNumber() / s.toDecimal()Whole or decimal number from text
Numbers
WriteGives you
amt.round(2)Rounded to two decimal places for rupees and paise
a % bRemainder after division
amt.toString()Text you can join into a message
abs(x)Value without its minus sign, for difference checks
max(a, b) / min(a, b)Larger or smaller of two numbers
Lists
WriteGives you
L = list(); or L = {"a","b"};An empty or filled list
L.add(x) / L.addAll(other)One item or a whole list appended
L.get(0)First item (index starts at 0)
L.size()How many items
L.contains(x) / L.indexOf(x)Is it there, and where
L.remove(i)Drops the item at position i
L.sort(true)Ascending sort; false gives descending
L.distinct()Duplicates dropped, such as repeated email IDs
Maps (key-value)
WriteGives you
m = Map();An empty map, the shape almost every Zoho API call expects
m.put("Stage", "Won")Adds or overwrites a key
m.get("Stage")The value, or null when the key is missing
m.containsKey("GSTIN")true or false, safer than reading a missing key
m.keys()A list of keys to loop through
m.remove("tmp")Map without that key
txt.toMap() / txt.toJSONList()JSON text turned into a map or a list of maps
Dates and times
WriteGives you
zoho.currentdate / zoho.currenttimeToday, or now, in the app's time zone
d.addDay(30) / d.addMonth(1)A date moved forward; use a minus number to go back
daysBetween(d1, d2)Whole days from d1 to d2, such as days overdue
d.getYear() / d.getMonth()Parts of a date, for financial-year logic
d.toString("dd-MM-yyyy")Date as text in the pattern you give
"15-08-2026".toDate()Text read as a date (the text must follow the app's date format)

Function names as Zoho documents them in November 2026. Each Zoho app can add its own tasks on top, so check the app's help page when a function is missing.

How do conditions and loops work in Deluge?

Conditions use if, else if and else with the usual &&, || and !. For repetition there is exactly one loop, for each, which walks through a list, a map's keys or a set of records. Deluge has no while loop, by design.

// Sample: tag a deal by value band and list its pending items
amount = 425000;
if (amount >= 1000000)
{
	band = "Large";
}
else if (amount >= 200000)
{
	band = "Mid";
}
else
{
	band = "Small";
}
pending = {"PO copy", "GST certificate", "Site address"};
for each doc in pending
{
	if (doc == "Site address")
	{
		continue;   // skip this one
	}
	info band + " deal still needs: " + doc;
}
  • Counting loops. To run something five times, loop over a list such as {1,2,3,4,5}. For a longer run, build the list first with a text trick: leftpad("", 20).replaceAll(" ", "x,").toList(",") gives you a list to walk through.
  • break and continue are both available inside for each.
  • Inline choice. label = if(qty > 0, "In stock", "Out of stock"); works where a full block feels heavy.

How do you read and write records in Zoho CRM and Zoho Creator?

In Zoho CRM you call integration tasks such as zoho.crm.getRecordById and zoho.crm.updateRecord, passing maps. In Zoho Creator you query forms directly with square-bracket criteria, then change fields by assignment. The two styles look different, so keep them apart in your head; our tutorial on fetching records in Deluge covers paging, sorting and empty results in more depth.

Zoho CRM (custom functions, workflows, buttons)

// dealId arrives as the function argument
dealRec = zoho.crm.getRecordById("Deals", dealId);
acct = dealRec.get("Account_Name");          // lookup returns a map
if (acct != null)
{
	upd = Map();
	upd.put("Last_Deal_Stage", dealRec.get("Stage"));
	resp = zoho.crm.updateRecord("Accounts", acct.get("id"), upd);
	info resp;
}
found = zoho.crm.searchRecords("Leads", "(Email:equals:[email protected])");

Zoho Creator (form workflows and functions)

// Fetch, update, count and insert in a Creator app (Sample form names)
open = Service_Calls[Status == "Open" && Zone == "Electronic City"];
for each call in open sort by Added_Time
{
	call.Status = "Assigned";
}
total = Service_Calls[Status == "Open"].count();
newId = insert into Service_Calls
[
	Added_User = zoho.loginuser
	Customer = input.Customer
	Status = "Open"
];

Creator's insert block uses line breaks, not commas, between fields. Inside a form workflow, input.Field_Name reads what the user typed before saving. For more Creator patterns, our guide to Zoho Creator custom business apps shows how forms, reports and workflows fit together, and the CRM workflow rules guide explains when a rule alone does the job and when it needs a function.

What is the syntax for invokeurl, sendmail and try-catch?

invokeurl and sendmail are task blocks with named parameters inside square brackets. Wrap calls to outside systems in try and catch so one failed request does not stop the whole function.

// Read unpaid invoices from Zoho Books on the India data centre (Sample org ID)
try
{
	params = Map();
	params.put("organization_id", "60000000000");
	params.put("status", "unpaid");
	resp = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/invoices"
		type :GET
		parameters:params
		connection:"books_conn"
	];
	for each bill in resp.get("invoices")
	{
		info bill.get("invoice_number") + " : " + bill.get("balance");
	}
}
catch (e)
{
	info "Line " + e.lineNo + ": " + e.message;
}
sendmail
[
	from :zoho.adminuserid
	to :"[email protected]"
	subject :"Overdue invoices for " + zoho.currentdate.toString("dd-MMM-yyyy")
	message :"Total open: " + total
]
  • Connections, not tokens. Name a connection in the app's settings and refer to it with connection:. Zoho stores and refreshes the OAuth token for you, so no secret ever sits in the script.
  • India accounts. Calls to another Zoho app on an Indian account go to zohoapis.in. Built-in tasks such as zoho.books.getRecords pick the data centre themselves.
  • Headers and bodies. Add headers: with a map, and for a JSON POST send parameters:body.toString() with a Content-Type header.

When the calling side lives outside Zoho, the same API can be reached from your own code instead; our Zoho Books API guide for Python covers that route, including tokens and rate limits.

Which Deluge lines do Indian businesses use again and again?

Checks on GSTIN, PAN, PIN code and mobile numbers, the Indian financial year, and amounts in rupees. These short blocks belong in a shared function so every form and module validates the same way.

// GSTIN: 15 characters, state code first, PAN inside
gstin = input.GSTIN.trim().toUpperCase();
if (!gstin.matches("[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]"))
{
	alert "Please check the GSTIN format.";
	cancel submit;
}
stateCode = gstin.subString(0, 2);    // "29" is Karnataka
pan = gstin.subString(2, 12);

// Mobile: keep digits, keep the last 10
mob = input.Mobile.replaceAll("[^0-9]", "");
if (mob.length() > 10) { mob = mob.subString(mob.length() - 10, mob.length()); }

// Financial year label from a date (April to March)
d = zoho.currentdate;
fyStart = if(d.getMonth() >= 4, d.getYear(), d.getYear() - 1);
fy = "FY " + fyStart + "-" + (fyStart + 1).toString().subString(2, 4);

A format check is not a verification. The pattern tells you a GSTIN is well formed, not that it is active; for that, the buyer's details on the GST portal are the source of truth, and your accounts team decides how to check them. For ready-made blocks by task, browse our Deluge code snippets library.

Tap each card

Which Deluge mistakes cost the most time?

Most broken scripts we are asked to fix fail for one of six reasons. None needs a rewrite; each needs one line changed.

Zoho sets execution and API limits for each app and plan. Read the limits listed in that app's developer help before you design a bulk job.

Sort your task

Which Deluge construct fits the job in front of you?

Keep the cards that describe your task and the deck tells you what to write. If your list ends up mixing four or five constructs, the job is probably a proper custom function, and we can scope it with you.

  • Eight common tasks
  • Each points to the syntax on this page
  • Send your picks with the form if you want help

When should you write Deluge yourself and when should you hand it over?

Write it yourself when the script reads and updates a few fields inside one app and an admin can test it on sample records. Hand it over when it moves money, posts tax data, calls outside systems or runs across thousands of records, because those need error handling, logging and a test plan.

  • Test on copies. Use a sandbox where your Zoho plan offers one, or a test record set marked clearly as Sample.
  • One owner per function. Name the person who gets the error mail, and keep a short note of what each function does.
  • Version by hand. Paste the old script into a text file with the date before you change a live function.
  • Blueprints and workflows first. Many "we need code" requests are solved by built-in automation; the Zoho CRM Blueprint tutorial shows where process rules end and scripts begin.

Have a script that half works?Send it with the error text. We tell you which lines to change, or whether the job needs a proper custom function.

Book my free Zoho fit assessment

For production work, our Deluge scripting services team writes, reviews and documents functions across CRM, Creator, Books and Desk, priced as a fixed amount in a signed scope. If you would rather have someone inside your team for a few months, see how to hire a Deluge developer from us. We train admins in English, Hindi, Marathi, Tamil, Kannada or Malayalam, so the scripts stay understood after handover.

Written by

Who put this Deluge cheatsheet together?

The Zoho developers at Elite Tech Corp, a Zoho Advanced Partner and Zoho Creator Registered Partner with 300+ Zoho projects since 2021. The client quotes below speak about our Zoho work in general, not about this cheatsheet.

The team at Elite Tech Corporation is highly knowledgeable and extremely supportive. They took the time to understand each of our business use cases in detail and approached every requirement with a strong implementation mindset.
KVP EnterprisesFounder and CEO · manufacturing automation
What stood out most was their structured approach, clarity in communication, and commitment to aligning technology with practical, on-ground operations rather than offering generic solutions.
MegawinFounder and CEO · multiple Zoho applications
Your understanding of our requirements and customization of Zoho Books have positively impacted our operations. The successful implementation of APIs and workflows has streamlined processes.
F Care GroupFounder and CEO · Zoho Books, APIs, workflows

FAQ

Deluge syntax questions admins ask us

Got an error message you cannot place? Paste it into the form with the app name. We reply within 1 business hour.

Book my free Zoho fit assessment
What exactly is Zoho Deluge used for?

Deluge (Data Enriched Language for the Universal Grid Environment) is Zoho's own scripting language. It runs inside Zoho CRM, Creator, Books, Desk, People and many other Zoho apps for custom functions, workflows, buttons and schedules, and it has built-in tasks for reading and writing data across Zoho apps.

Does Deluge have a while loop?

No. The only loop in Deluge is for each, which walks through a list, the keys of a map or a set of fetched records. To repeat a block a fixed number of times, loop over a list of that length. break and continue work inside for each.

How do I write a date in Deluge?

Put a date or date-time inside single quotes, such as '01-Apr-2026', or take zoho.currentdate and move it with addDay or addMonth. Text in double quotes is not a date until you convert it with toDate(), and it must follow the app's date format.

What is the difference between a list and a map in Deluge?

A list is an ordered set of values read by position, starting at 0, written as {"a","b"} or list(). A map holds key and value pairs read by key, created with Map() and filled with put(). Most Zoho API calls take a map and return a map or a list of maps.

Does Deluge support try and catch?

Yes. Wrap risky statements, such as invokeurl calls to outside services, in try { } and handle the problem in catch (e) { }. The error object gives you the line number and the message, which you can log or mail to the function's owner.

Why does my invokeurl call fail on an Indian Zoho account?

The usual cause is a .com API host or a connection created on a different account. Accounts on Zoho's India data centre call zohoapis.in, and the connection named in the call must belong to the same account with the scopes the call needs.

Can Deluge validate a GSTIN?

Deluge can check that a GSTIN is well formed with the matches() function and a pattern, and pull out the state code and PAN with subString(). A format check does not prove the GSTIN is active; your accounts team should confirm that through the GST portal.

Is there a cost to run Deluge in Zoho?

Deluge comes with the Zoho app you already pay for; there is no separate Deluge license. Each app and plan sets its own limits on executions and API calls, so heavy scheduled jobs may need a higher plan or a different design.

Deluge help

Stuck on a Deluge script that should already work?

Paste the error text and tell us which Zoho app runs the script. We reply within 1 business hour, usually with the line we would change first.

  • We read your script against the app it runs in
  • Connections, scopes and the India data centre checked
  • Bigger builds scoped as a fixed price in a signed scope

Tell us about your business

Three short steps. Fields marked * are required.

Your need
Your company
How we reach you

Privacy notice. We collect the details in this form (name, business email, phone, company, city and your requirement) only to reply to your enquiry and arrange the assessment. They are stored in Zoho CRM, the system we use to manage enquiries, and are never sold or used for advertising. The updates box is optional and you can withdraw it at any time. To see, correct or delete your details, or to withdraw consent, call +91 89259 24785 or message us on WhatsApp. Read our privacy policy.