Articles

6 Zoho CRM Custom Functions Every Developer Should Know.

6 min read

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.

Frequently asked questions.

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.

How do you pass record data into a Zoho CRM custom function?

When a function is attached to a workflow or button, you map arguments from the record, such as the record ID or a field value, and the function receives them as parameters. Passing only the ID and reading the record inside the function keeps the script resilient to layout changes. For standalone functions called by API, arguments arrive as request parameters. Always validate the arguments before using them, since an empty ID produces confusing errors.

How should a custom function authenticate to an external API?

Use a connection. Zoho CRM connections store OAuth or token credentials once, and the function references the connection name in invokeurl, so no secret appears in the script or the execution log. For services that only offer a static key, store it in an organization variable with restricted access rather than in code. Rotate credentials on a schedule and remove test keys before the function goes live.

What is the difference between a custom function and a client script?

A custom function runs on Zoho's servers after an event such as a workflow trigger, a button click or a schedule, and it can update records and call external systems. A client script runs in the user's browser while they are on a form, reacting to field changes or page load, which suits live validation and dynamic form behavior. Use client scripts for in-form experience and custom functions for logic that must run however the record was changed.

How do you version and back up custom functions in Zoho CRM?

Zoho CRM keeps the current function code and limited history, so most teams copy each function into a repository alongside a note on its trigger and purpose. Changes go through the sandbox first, and the repository commit records who changed what. When a function breaks after an edit, the repository gives you the previous version to restore. Treat Deluge like any other production code.

What access does a Zoho CRM developer need to start work?

A user with administrator or developer profile rights in a sandbox, the list of modules and field API names involved, access to the external systems' API documentation and test credentials, and a named business contact who can answer questions about the process. Avoid granting production admin rights until the work has passed testing. A developer working blind in production is the most common source of broken integrations.

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.

Find out what one connected Zoho system would change in the way you run.

In a no-risk discovery we look at your CRM, finance and operations systems and who owns each part, and show what a connected system would do differently. You pay only if you proceed. Or see how we approach it.

Book the no-risk discovery

More on the same problem:

Not yet on Zoho, or already there?

Start a Zoho One trial through our sign-up, or tag us as your Zoho partner for free consulting time every month.

Where we're not the right answer

We'll tell you if we're a fit. If we're not, we'll tell you that too.

  • Your current stack works and nobody wants to change it
  • You want licences resold at a discount and nothing else
  • Your internal team owns the operating model and is not handing it over
  • You want hours of configuration work and nothing run for you: that is on our services pages, and it is not a managed solution
How we start

Most of our best clients come to us with a feeling, not a plan.

"Something isn't working." "We're outgrowing our tools." "We're afraid to make the wrong move." No-Risk Discovery is a short, practical conversation that gets you clarity before you commit to anything big. We'll tell you if we're a fit. If we're not, we'll tell you that too.

Talk to us

Have a question about this?

Say who you are and ask. A person replies within one business day.

The rest of the form follows your answer.

A new client, or thinking about becoming one

Never shared. Never sold.

What are you looking for?An agentic solution (AI OS) is licensed and sold with managed services. An integrated solution is built for a professional services fee. A Service is professional work, done by the hour, the month or the project. Not sure yet is a fine answer.

Tick every one that applies, or not sure yet.

Agentic solutions (AI OS)

Integrated solutions

Services

Platforms you run today

Pick every one that applies. Choosing one is an answer too.