Book a Meeting

Zoho Advanced Partner · Deluge snippet library

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.

We reply within 1 business hour · No obligation

Snippet finder

Three taps, then your matches

Which Zoho app will run the script?
What should set it off?
What is the job?
300+
Zoho projects, many with Deluge under the hood
2021
Writing Zoho scripts since
6 languages
Handover sessions, English to Malayalam
ZohoAdvancedPartner

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.

The library

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.

DelugeSample
// Argument: dealId. Connection "books_conn" with Books invoice scope.
orgId = "SAMPLE_ORG_ID";
deal = zoho.crm.getRecordById("Deals", dealId);
custId = deal.get("Books_Customer_ID");
if(custId == null)
{
	info "No Books customer linked to deal " + dealId;
	return;
}
line = Map();
line.put("name", deal.get("Deal_Name"));
line.put("rate", deal.get("Amount"));
line.put("quantity", 1);
inv = Map();
inv.put("customer_id", custId);
inv.put("reference_number", deal.get("Deal_Name"));
inv.put("line_items", {line});
resp = zoho.books.createRecord("invoices", orgId, inv, "books_conn");
info resp.get("message");
  • 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.

DelugeSample
// Form link name: Job_Card. Field: Job_No (single line)
today = zoho.currentdate;
n = Job_Card[Added_Time >= today].count();
seq = (n + 1).toString().leftpad(3).replaceAll(" ", "0");
input.Job_No = "JC-" + today.toString("yyMMdd") + "-" + seq;
  • 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.

DelugeSample
// Arguments: ticketId (Ticket Id), tier (Account > Support_Tier)
orgId = "SAMPLE_DESK_ORG_ID";
priority = "Medium";
if(tier == "AMC Gold")
{
	priority = "High";
}
upd = Map();
upd.put("priority", priority);
resp = zoho.desk.update(orgId, "tickets", ticketId, upd, "desk_conn");
info resp;
  • 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.

DelugeSample
orgId = "SAMPLE_ORG_ID";
resp = zoho.inventory.getRecords("items", orgId, Map(), "inventory_conn");
msg = "";
for each item in resp.get("items")
{
	stock = ifnull(item.get("stock_on_hand"), 0);
	reorder = ifnull(item.get("reorder_level"), 0);
	if(reorder > 0 && stock <= reorder)
	{
		msg = msg + item.get("name") + ": " + stock + " left, reorder at " + reorder + "\n";
	}
}
if(msg != "")
{
	zoho.cliq.postToChannel("purchase", "Low stock this morning\n" + msg);
}
  • 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.

DelugeSample
try
{
	resp = zoho.crm.updateRecord("Deals", dealId, upd);
	if(resp.get("id") == null)
	{
		info "Update refused for deal " + dealId + ": " + resp;
	}
}
catch (e)
{
	sendmail
	[
		from :zoho.adminuserid
		to :zoho.adminuserid
		subject :"Deal update failed: " + dealId
		message :e.toString()
	]
}
  • Built-in tasks such as updateRecord usually return the error in the reply rather than throwing it, which is why both checks are there.
  • Send failure mail to a shared admin inbox so alerts survive staff changes.

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
SuitsOne app, one record, low riskTwo Zoho apps or a daily scheduleOutside systems, heavy volumes, webhooks in
Field names and IDsYou swap the samplesMapped from your org's setupDesigned with the data model
Error handlingAs shown in the snippetResponse checks and an admin alertRetries, logs and a failure queue
TestingYour own test recordSandbox run with your sample data, signed off by youTest plan written into the scope
Who maintains itYour adminYour admin, with a short design noteAgreed in the support terms
What our side costsNothing; the snippet is free to useQuoted as one fixed figure, scope signed firstOne fixed figure, written into the signed scope
Watch forLimits and loops nobody spots until a busy dayA connection owned by one staff loginBuilding 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.

  1. Vendor GSTIN check
  2. Job card numbers
  3. Material alerts
  4. Invoice from order

Zoho for manufacturers

  • Start withSnippets 3 and 7 in Creator
  • ThenSnippet 9 for consumables and raw material
  • Watch forShift supervisors on shared logins, which hide who did what

What Deluge costs

Do you pay extra to run Deluge in Zoho?

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 Books Native
  • Inventory stock read by a schedule Native
  • Desk ticket updates Native
  • Messages posted to Cliq channels Native

Indian services

Confirmed with your provider during scoping

  • WhatsApp Business messages through a supported provider Marketplace or Custom
  • Click-to-call and call logs for supported telephony providers Marketplace
  • SMS gateways and pincode lookups Custom
  • GSTIN status from a licensed GST service Custom

Systems you keep

Where Deluge meets software that stays

  • Tally, while finance moves across in stages Custom
  • An existing ERP or MES Custom
  • Payment gateway webhooks Custom
  • Heavy jobs moved to Zoho Catalyst Custom

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.

  1. 1Name the triggerWrite one line: which record, which event, which field change. Narrow triggers prevent loops.
  2. 2Map real namesSwap sample field API names, picklist values and org IDs for the ones in your setup.
  3. 3Set up connectionsCreate each connection with only the scopes the script needs, under a shared admin login.
  4. 4Run on a test recordUse a sandbox or a record marked TEST, including one with blank fields, and read every info line.
  5. 5Switch it onAttach the function to its rule or schedule and watch the execution log for the first busy day.
  6. 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
  • Call or WhatsApp +91 89259 24785
  • Meetings, workshops and training by appointment
  • Consultations and training in English, Hindi, Marathi, Tamil, Kannada and Malayalam
Loads Google Maps

Kochi branch Kochi

G16, 62/5011, Iyyattil Junction, Shenoys,
Kochi, Ernakulam, Kerala 682011
  • Call +91 89256 97717
  • Meetings, workshops and training by appointment
  • Consultations and training in English, Hindi, Marathi, Tamil, Kannada and Malayalam
Loads Google Maps

Coimbatore head office Head office

Kalpavriddhi building, Vilankurichi Road,
Indhuma Nagar, Coimbatore, Tamil Nadu
  • Call +91 89256 97727
  • Meetings, workshops and training by appointment
  • Consultations and training in English, Hindi, Marathi, Tamil, Kannada and Malayalam

Meet in person

  • Vasanth Nagar office in Bangalore, by appointment
  • Head office in Coimbatore, branch in Kochi
  • Screen-share reviews for every other city

Handover languages

  • Script walkthroughs in English, Hindi, Marathi, Tamil, Kannada or Malayalam
  • Recorded sessions for admins who join later
  • Comments in the code kept in plain English

Western India

Teams near our Bangalore office can read our Bangalore Zoho partner page, and Creator-heavy setups may prefer our Zoho Creator work in Bangalore.

Client words

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
TrukkingLulu HolidaysMegawinJADKingsSygaardJemkonBrealantRockolyLendonRohealthTengani

One rollout in detail: KVP Enterprises. Other write-ups sit in the case study library.

FAQ

Questions about Deluge code

Stuck on a script that is not on this page? Send it over and a developer will read it before replying.

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

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.

Free Zoho fit assessment

Need a snippet adapted to your own Zoho org?

Paste the snippet number or describe the automation in two lines. A Deluge developer reads it before we reply, within 1 business hour. No obligation.

  • We check field API names, connections and edition limits in your org
  • You get a short design note before any code is written
  • Larger scripting work is a fixed price agreed 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.