top of page
CodeStringers - One Partner - Better Outcomes

HOW TO EXPLORE FIT

See whether we're the right partner — before you commit to anything.

No-Risk Discovery is a short, practical conversation that gets you a clear view of your options — with no obligation to keep working with us.

6 Zoho CRM Custom Function Examples Worth Building

  • Aug 1
  • 4 min read

Updated: 6 days ago

Abstract editorial illustration of Zoho CRM automation with Deluge code flowing between connected function nodes.

A sales manager once asked us why his reps spent the first hour of every morning copying deal amounts into a spreadsheet by hand. The CRM already held the numbers — nobody had wired them together. That gap is exactly what custom functions close, and it's the kind of small automation a Custom software developer can stand up in an afternoon. Zoho gives you a scripting layer for precisely these moments, and the best way to learn it is to steal from working Zoho CRM custom function examples.


A Zoho CRM custom function is a snippet of Deluge script that runs your own logic inside the CRM — updating records, calling other apps, doing math the point-and-click builder can't. You attach it to a trigger, it fires, and work that used to be manual just happens.


Where Zoho CRM custom functions actually run

Before the examples, know your triggers. Per Zoho's Functions documentation, a custom function can be invoked from workflow rules (fires automatically when the rule's conditions are met), custom buttons (runs on a click from a record), schedules (runs on a date/time and frequency you set), and standalone functions exposed as REST APIs so anything — inside CRM or a third-party app — can call them. One catch worth remembering: a function built for one location can't be reused in another. A workflow function isn't available to a schedule, so scope each one to how it'll be triggered.


This kind of low-code plumbing is no longer a niche. Gartner projects that by 2025, 70% of new applications will use low-code or no-code technologies, up from less than 25% in 2020 (App Builder, citing Gartner). Custom functions are how you get that leverage without leaving the CRM.


6 Zoho CRM custom function examples worth building

Here are patterns we reach for again and again. Each snippet is illustrative — treat field and module names as placeholders to map to your own schema.


1. Auto-create a follow-up task. Attach this to a workflow rule on Deals so a rep never has to remember to schedule the next touch.


task = Map();
task.put("Subject", "Follow up on " + deal.get("Deal_Name"));
task.put("Due_Date", zoho.currentdate.addDay(3));
task.put("Se_Module", "Deals");
task.put("What_Id", dealId);
zoho.crm.createRecord("Tasks", task);

2. Roll a subform total up to the parent. Line items live in a subform; the deal needs their sum. Loop the rows and write one field.


deal = zoho.crm.getRecordById("Deals", dealId);
total = 0.0;
for each row in deal.get("Line_Items")
{
    total = total + ifnull(row.get("Amount"), 0);
}
update = Map();
update.put("Order_Total", total);
zoho.crm.updateRecord("Deals", dealId, update);

3. Sync a record to an external app with invokeurl. When a contact is created, push it to your billing or provisioning system. This is the workhorse for integrations — our Zoho CRM consultants build most connectors on top of it.


payload = Map();
payload.put("name", contact.get("Full_Name"));
payload.put("email", contact.get("Email"));
response = invokeurl
[
    url: "https://api.example.com/v1/customers"
    type: POST
    parameters: payload.toString()
    headers: {"Authorization": "Bearer " + apiKey, "Content-Type": "application/json"}
];

4. Format and validate a phone number. Strip everything but digits, then reformat — so reports and dialers stop choking on inconsistent data.


raw = ifnull(contact.get("Phone"), "");
digits = raw.replaceAll("[^0-9]", "", true);
if(digits.length() == 10)
{
    formatted = "(" + digits.subString(0,3) + ") " + digits.subString(3,6) + "-" + digits.subString(6);
    upd = Map();
    upd.put("Phone", formatted);
    zoho.crm.updateRecord("Contacts", contactId, upd);
}

5. Post to Slack or Teams on a stage change. Give the team a live signal instead of a report they'll check tomorrow. Point the function at an incoming webhook URL.


msg = Map();
msg.put("text", deal.get("Deal_Name") + " moved to " + deal.get("Stage"));
invokeurl
[
    url: "https://hooks.slack.com/services/XXX/YYY/ZZZ"
    type: POST
    parameters: msg.toString()
];

6. Generate a sequential number. Invoices and cases often need a clean running ID. Pull the last record, increment, and write it back.


lastList = zoho.crm.getRecords("Invoices", 1, 1, {"sort_by":"Created_Time","sort_order":"desc"});
lastNum = 1000;
if(lastList.size() > 0)
{
    lastNum = lastList.get(0).get("Sequence_No").toLong();
}
upd = Map();
upd.put("Invoice_Number", "INV-" + (lastNum + 1));
upd.put("Sequence_No", lastNum + 1);
zoho.crm.updateRecord("Invoices", recordId, upd);

For deeper technique — error handling, retries, and idempotency — our Zoho Deluge best practices and how to call a REST API in Deluge go further than these snippets can. And when a function needs to talk to a real external system, a clean Zoho integration matters more than the script itself.


Want these built and tested against your own modules? Book a free Zoho consultation.


FAQ

Do I need a developer to write Zoho CRM custom functions? Not always. Simple field updates and task creation are learnable from Zoho's samples. But anything touching external APIs, authentication tokens, or bulk record updates benefits from an engineer who can handle error cases, rate limits, and edge conditions that break silently in production.


Can a custom function call another custom function? Yes. Standalone functions exposed as APIs can be invoked from other Deluge scripts, letting you build a small library of reusable logic. Keep shared helpers standalone so a workflow function and a button can both reach the same code without duplication.


What happens if a custom function fails mid-execution? Zoho logs the failure, but partial updates may have already committed before the error. Design functions to be idempotent and check for existing records before creating duplicates, so a re-run doesn't corrupt data or double-create tasks and invoices.


Are there limits on how many custom functions I can run? Yes — Zoho enforces edition-based limits on function executions and daily API calls. High-volume automations can hit them, so check your plan's Deluge and API caps before wiring a function to a high-frequency trigger or a large scheduled batch.


The takeaway

Custom functions turn Zoho CRM from a place where data sits into a system that acts — creating tasks, syncing apps, and enforcing your rules without a human in the loop. Start with one of the six patterns above, map the field names to your setup, and test in a sandbox before you flip it live. When you're ready to build something bigger than a snippet, book a free Zoho consultation and we'll scope it with you.


By the CodeStringers Team — Zoho Experts & Custom Software. We're a custom software engineering firm with a dedicated Zoho practice, writing from automations we've actually shipped for clients — not theory.

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

About CodeStringers

CodeStringers helps growth-stage and small-to-mid-market companies implement, integrate, extend, and operate Zoho-centered business “operating systems”. The company combines fractional technology leadership, business systems integration, custom software development, and managed technical operations to help clients reduce operational friction and improve business outcomes.

Subscribe

We'll send you periodic updates when new articles, thought leadership content and news is released.

Featured Articles

bottom of page