Deluge code examples for Zoho CRM, Creator, Books and Desk
Here are eleven working patterns in Deluge, Zoho's own scripting language, sorted by the task each one handles: cleaning phone numbers, stopping duplicate leads, checking a GSTIN, turning a won deal into a Books invoice, overdue digests, stock alerts and safe API calls. Each one shows the code, where to paste it and what usually breaks.
Our Deluge developers wrote these for Indian Zoho setups. Field names, organisation IDs and connection names are samples, so run every snippet in a sandbox or on a test record before it touches live data.
Also Zoho Creator Registered, Zoho Catalyst, AWS and Shopify Partner
Zoho Advanced Partner of the Year 2025
Choose your role
Who gets the most out of a Deluge snippet library?
Admins writing their first custom function, developers who know JavaScript or Python but not Deluge, and owners whose old automation has started failing. Pick the one that sounds like you to see which snippets to open first.
You run Zoho day to day and want one small automation
Open first
Snippet 1, phone numbers in one format
Snippet 3, GSTIN check on a Creator form
Snippet 7, readable job card numbers
Leave for later
Anything that writes to a second app
Scheduled jobs that loop over every record
Outside API calls that need a connection
Single-app scripts that read and update one record are the safest place to learn. Our guide to Zoho CRM workflow rules explains where a function sits inside a rule.
You write code already, just not in Deluge
Open first
Snippet 10, invokeurl with a full response check
Snippet 11, try and catch around an update
Snippet 6, regex inside a reusable function
Expect surprises with
Maps and lists that behave loosely with types
No while loop, so iteration runs over lists
Built-in tasks that return errors instead of failing
The language is small; the hard part is each app's limits and API names. When a piece is too heavy for Deluge, Zoho Catalyst usually takes it.
Something that used to run on its own has gone quiet
Check first
The function's execution log for the failing date
Whether a field was renamed or a picklist value changed
Connection status, since expired authorisations stop calls
Avoid
Pasting a fresh snippet over the old one blind
Editing the live function without a copy
Turning the workflow off and forgetting it
Most silent failures come from one changed field. If you would rather hand it over, our Deluge scripting team reads the log first.
Which Deluge snippet does the job you have in mind?
Search by word, or filter by app and by what triggers the script. Every card says where the code goes, the arguments it expects and the traps to check. IDs, emails and connection names are samples you replace with your own.
Showing all 11 snippets
1
Store every Indian mobile number as +91 and ten digits
Zoho CRMWorkflow: Leads, on create
Web forms, IndiaMART imports and sales reps all type numbers differently: spaces, an extra 0 in front, 0091, brackets. This strips everything but digits, keeps the last ten and writes them back with the country code, so search, WhatsApp links and duplicate checks all see the same value.
DelugeSample
// Argument: leadId (map it to Lead Id in the workflow)
lead = zoho.crm.getRecordById("Leads", leadId);
raw = ifnull(lead.get("Mobile"), "");
digits = raw.replaceAll("[^0-9]", "");
if(digits.length() > 10)
{
digits = digits.right(10);
}
if(digits.length() == 10)
{
upd = Map();
upd.put("Mobile", "+91" + digits);
resp = zoho.crm.updateRecord("Leads", leadId, upd);
info resp;
}
Numbers shorter than ten digits are left alone on purpose; a report on them finds typing mistakes.
Landlines with an STD code need their own rule, so use the Phone field for those.
2
Flag a new lead whose mobile already belongs to a customer
Zoho CRMWorkflow: Leads, on create
Repeat buyers often fill the enquiry form again. Instead of letting a rep cold-call an existing account, the script searches Contacts for the same mobile and marks the lead so it goes to the account owner.
DelugeSample
// Argument: leadId. Run after snippet 1 so formats match.
lead = zoho.crm.getRecordById("Leads", leadId);
mobile = ifnull(lead.get("Mobile"), "");
if(mobile != "")
{
found = zoho.crm.searchRecords("Contacts", "(Mobile:equals:" + mobile + ")");
if(found.size() > 0)
{
upd = Map();
upd.put("Lead_Status", "Existing customer");
upd.put("Description", "Same mobile as contact " + found.get(0).get("id"));
zoho.crm.updateRecord("Leads", leadId, upd);
}
}
"Existing customer" must already exist as a picklist value, or the update is rejected.
If the plus sign in +91 upsets the search, URL-encode the value or search on the ten digits only.
3
Check the GSTIN pattern before a Creator form saves
Zoho CreatorForm: Validations, on submit
A vendor or customer master with a mistyped GSTIN causes trouble months later at return time. This stops the save when the 15 characters do not follow the GSTIN layout, and stores the value in capitals.
DelugeSample
// Field link name: GSTIN (single line)
if(input.GSTIN != null && input.GSTIN != "")
{
gstin = input.GSTIN.toUpperCase().trim();
if(!gstin.matches("[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]"))
{
alert "Please enter a 15-character GSTIN, for example 29ABCDE1234F1Z5";
cancel submit;
}
input.GSTIN = gstin;
}
This checks the shape only. It cannot tell whether the GSTIN is registered or active; that needs the GST portal or a licensed GST service.
The example GSTIN in the alert is a format sample, not a real business.
4
Raise a draft Zoho Books invoice when a deal is won
Zoho CRM to BooksWorkflow: Deals, stage Closed Won
Sales closes the deal and accounts retypes it into Books: that gap is where amounts drift. The function builds one invoice line from the deal and creates it in Books as a draft, so a person still checks tax and place of supply before sending.
Books_Customer_ID is a sample custom field; many setups get the customer from the native CRM and Books sync instead.
CGST plus SGST or IGST depends on the customer's state, so pass the right tax per line or leave the invoice as a draft for accounts.
5
Email accounts a morning list of overdue invoices
Zoho BooksSchedule: daily, 9.30 am
Collections improve when someone sees the list every morning instead of at month end. The schedule pulls overdue invoices, totals the balance in rupees and mails one short table to the accounts inbox.
DelugeSample
orgId = "SAMPLE_ORG_ID";
resp = zoho.books.getRecords("invoices", orgId, "status=overdue", "books_conn");
rows = "";
total = 0;
for each inv in resp.get("invoices")
{
rows = rows + inv.get("invoice_number") + " | " + inv.get("customer_name") + " | Rs " + inv.get("balance") + " | due " + inv.get("due_date") + "<br>";
total = total + inv.get("balance");
}
if(rows != "")
{
sendmail
[
from :zoho.adminuserid
to :"[email protected]"
subject :"Overdue invoices today: Rs " + total
message :rows
]
}
Books returns records page by page, so a long list needs a page loop before the totals are right.
Pair it with snippet 6 if the team prefers lakh and crore commas in the subject line.
6
Format rupee amounts with lakh and crore commas
Creator or any appReusable function, called by other scripts
Emails and PDFs built in Deluge print 1234567 by default, and Indian readers expect 12,34,567. This small function keeps the last three digits, then peels off pairs from the right.
DelugeSample
string formatINR(decimal amount)
{
whole = amount.round(0).toLong().toString();
if(whole.length() <= 3)
{
return whole;
}
last3 = whole.right(3);
rest = whole.left(whole.length() - 3);
groups = "";
for each i in {1, 2, 3, 4, 5}
{
if(rest.length() > 2)
{
groups = "," + rest.right(2) + groups;
rest = rest.left(rest.length() - 2);
}
}
return rest + groups + "," + last3;
}
// formatINR(1234567) gives "12,34,567"; handles up to 13 digits
Negative amounts and paise need two extra lines; credit notes are the usual case.
The function editor writes the header for you, so paste only the body if the editor already shows one.
7
Give each job card a number people can read aloud
Zoho CreatorForm: Validations, on submit
Record IDs are nineteen digits long and nobody on a shop floor can say them on a call. This builds JC-yyMMdd-001 style numbers from the date and the count of cards added today.
Two submissions in the same second can get the same number, so mark Job_No as "No duplicate values".
Creator's built-in auto number field is simpler when the date prefix is not needed.
8
Raise ticket priority for customers on an AMC
Zoho DeskWorkflow: Tickets, on create
Customers who pay for an annual maintenance contract expect a faster answer. The workflow passes the account's tier into the function, which sets the ticket's priority before any agent picks it up.
Support_Tier is a sample account field; the priority values must match the ones in your Desk layout.
SLAs keyed to priority start counting from the update, so test the timing on a sample ticket.
9
Post a low-stock list to the purchase team's Cliq channel
Zoho Inventory and CliqSchedule: daily, before the purchase meeting
Reorder levels only help if someone looks at them. This reads items, keeps the ones at or under their reorder level and posts one message to a Cliq channel the buyers already use.
Large item lists come back in pages, as in snippet 5.
Stock per warehouse needs the warehouse details on each item, not the organisation total.
10
Call an outside API and check the response before using it
Any Zoho appInside any function: invokeurl
The common mistake is reading fields from a reply that was actually an error page. Asking for the detailed response gives you the status code, so the script only fills the city when the lookup really worked.
DelugeSample
// Sample provider URL and connection; use your own service.
resp = invokeurl
[
url :"https://api.yourprovider.in/v1/pincode/" + pin
type :GET
connection :"pincode_conn"
detailed :true
];
code = resp.get("responseCode");
if(code == 200)
{
body = resp.get("responseText").toString().toMap();
city = body.get("city");
}
else
{
info "Pincode lookup returned " + code + " for " + pin;
}
Keep API keys in a connection, never typed into the script where every admin can read them.
Each Zoho edition caps how many outside calls run a day, so batch the lookups that can wait.
11
Catch a failed update and tell the admin, not the customer
Zoho CRMAny function that writes data
Silent failures are worse than loud ones. The try block catches a script error, and the response check catches the quieter case where Zoho answers with an error message instead of a record ID.
Sample code. Field API names, organisation IDs, emails and connection names are placeholders; check them in your own org and run each snippet on a test record first.
Why pasted code fails
Why does a Deluge snippet that works elsewhere fail in your Zoho org?
Almost always because of names and permissions, not the logic. Tap each card for the symptom we see and the fix that usually clears it.
Copy, adapt or build
Should you paste a snippet yourself or have a developer adapt it?
Paste it yourself when the script touches one app and one record. Ask for a reviewed version when it writes to a second app or runs on a schedule. Plan a proper build when it talks to outside systems or carries money, stock or tax.
Three ways to use a Deluge snippet compared
Point
Paste it yourselfFrom this page
Adapted and reviewedBy our developersMost common
Custom buildDeluge with Catalyst or APIs
Suits
One app, one record, low risk
Two Zoho apps or a daily schedule
Outside systems, heavy volumes, webhooks in
Field names and IDs
You swap the samples
Mapped from your org's setup
Designed with the data model
Error handling
As shown in the snippet
Response checks and an admin alert
Retries, logs and a failure queue
Testing
Your own test record
Sandbox run with your sample data, signed off by you
Test plan written into the scope
Who maintains it
Your admin
Your admin, with a short design note
Agreed in the support terms
What our side costs
Nothing; the snippet is free to use
Quoted as one fixed figure, scope signed first
One fixed figure, written into the signed scope
Watch for
Limits and loops nobody spots until a busy day
A connection owned by one staff login
Building in code what a setting already does
Scripts by trade
Which Deluge scripts do Indian businesses ask for first?
It follows where retyping hurts most in that trade. These are the patterns we see across rollouts, mapped to the snippet numbers above.
Manufacturing units
Paper job cards, vendor masters and raw material alerts come up first. Planning and machine data stay in the system that runs them; Deluge only moves the business records around them.
Watch forMilestone billing that needs one invoice per milestone, not per deal
Online and retail sellers
Order queries and stock outs drive the first requests. Store platforms often have native connectors, so Deluge fills the gaps around them rather than replacing them.
Watch forSale days that burn through daily API limits
Clinics, diagnostic centres and labs
Scripts here handle corporate tie-ups, enquiry follow-up and support tickets. Zoho records hold the clinic's case number only; patient names, IDs and clinical details stay in the hospital or lab system.
No separate charge: Deluge comes built into the Zoho apps. What you pay for is the app license, and the edition you pick decides how many function runs and API calls a day you get. Use the calculator for a monthly and yearly license figure.
CRM Standard₹800 a user, each month
CRM Professional₹1,400 a user, each month
CRM Enterprise₹2,400 a user, each month
Creator Standard₹480 a user, each month
Creator Professional₹1,200 a user, each month
Desk Standard₹800 a user, each month
License figures are Zoho's India list rates, billed yearly, GST extra, as checked in November 2026. Zoho bills these licenses directly. Which editions allow custom functions, and how many runs they get, differs by app, so we check yours before writing code. Our own scripting work is a fixed price agreed in a signed scope; here is what moves that price.
What a snippet can reach
Which apps and services can a Deluge script connect to?
Other Zoho apps through built-in tasks, and outside services through invokeurl with a stored connection. Each link below carries its honest label: Native, Marketplace or Custom.
Zoho to Zoho
Built-in Deluge tasks, used in snippets 4, 5, 8 and 9
CRM records into BooksNative
Inventory stock read by a scheduleNative
Desk ticket updatesNative
Messages posted to Cliq channelsNative
Indian services
Confirmed with your provider during scoping
WhatsApp Business messages through a supported provider Marketplaceor Custom
Click-to-call and call logs for supported telephony providers Marketplace
SMS gateways and pincode lookupsCustom
GSTIN status from a licensed GST serviceCustom
Systems you keep
Where Deluge meets software that stays
Tally, while finance moves across in stagesCustom
An existing ERP or MESCustom
Payment gateway webhooksCustom
Heavy jobs moved to Zoho CatalystCustom
Providers and their Zoho extensions change, so each label is confirmed for your exact tools before code is written. Bigger connection work is covered under Zoho integration projects.
From snippet to live script
How does a copied snippet become a script you can trust on live data?
Six short steps, the same whether you do them or we do. Skipping the test record is the step that causes most of the clean-up calls we get.
1Name the triggerWrite one line: which record, which event, which field change. Narrow triggers prevent loops.
2Map real namesSwap sample field API names, picklist values and org IDs for the ones in your setup.
3Set up connectionsCreate each connection with only the scopes the script needs, under a shared admin login.
4Run on a test recordUse a sandbox or a record marked TEST, including one with blank fields, and read every info line.
5Switch it onAttach the function to its rule or schedule and watch the execution log for the first busy day.
6Write it downA short note on what it does, who owns it and what to check if it stops, kept with the function.
Your automation wishlist
Which scripts should your Zoho org get next?
Swipe right on the automations you want and left on the ones you can live without. At the end you see the apps involved, and one button copies your list into the contact form for a developer to review.
Ten automations Indian teams ask us for
Arrow keys work as well as swiping
Your list stays in your browser until you send the form
Working with our developers
Can a Deluge developer sit with our admin to go through the scripts?
Yes. Our offices are in Bangalore, Coimbatore and Kochi, with meetings by appointment. Teams in other cities across India work with us on screen-share sessions, and on-site days are added to the scope when a workshop helps.
Bangalore office Bangalore
#39, 8th Main Road, Vasanth Nagar, Bangalore, Karnataka 560052
How do clients describe our Zoho developers and consultants?
Testimonials published on our site by companies we have worked with, shown as they wrote them. They cover whole projects, not one snippet.
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
Deluge is the scripting language built into Zoho apps. It runs custom functions in Zoho CRM, form and report actions in Zoho Creator, automations in Books, Inventory and Desk, scheduled jobs, and calls to outside APIs. Most scripts fill gaps that the point-and-click workflow rules cannot cover.
Can I paste these Deluge snippets straight into my Zoho account?
Paste them into a test setup first. Each snippet uses sample field API names, organisation IDs and connection names, so you swap those for your own, run it on a test record and read the log before attaching it to a live workflow.
Are the code examples on this page free to use?
Yes. Copy and adapt them for your own Zoho org. If you want one adapted, reviewed and signed off by our developers, that work is a fixed price agreed in a signed scope.
Why does a Deluge script that works in one org fail in another?
Usually because field API names, picklist values, connection scopes or edition limits differ. Labels on screen are not the names the code uses, and a connection authorised by someone who has left will stop every call that depends on it.
Do all Zoho editions support Deluge custom functions?
Not equally. Which editions allow custom functions, schedules and outside calls, and how many runs they get each day, varies by app and edition. We check your edition and its limits before writing or adapting any script.
How do I call an outside API from Deluge safely?
Use invokeurl with a stored connection so keys never sit in the script, ask for the detailed response, and only read the reply after the status code shows success. Snippet 10 on this page shows the pattern.
How do I debug a Deluge function that fails silently?
Add info lines after each step, run the function manually against one test record, and open the execution log for the failing date. Check whether a built-in task returned an error message instead of a record ID, because those do not always stop the script.
Does the snippet finder send my answers to you?
No. The finder and the wishlist run in your browser. Your choices are copied into the contact form only when you press the button, and nothing reaches us until you submit that form yourself.
Can your team write or fix a Deluge script for us?
Yes. Send the snippet number or the failing script, and a developer reads it before replying. Small fixes and larger scripting work are both quoted as a fixed price in a signed scope, with a short design note and a handover session in your team's language.