A scheduled function is a Deluge script that runs automatically on a defined schedule — every day at 7am, every Monday morning, on the first of each month. Unlike workflow rules, which fire in response to record changes, scheduled functions fire on a clock. They are the right tool for automation that needs to run across many records at a defined time — nightly data cleanup, weekly performance reports, monthly territory rebalancing or any batch process that does not map to a single triggering event. This guide covers how scheduled functions work, how to write one and the patterns that make them reliable in production. For the foundational Deluge concepts, see the Deluge introduction guide. For the full automation context, see the Zoho Deluge scripting guide.
How Scheduled Functions Differ From Workflow-Triggered Functions
| Characteristic | Workflow-Triggered Function | Scheduled Function |
|---|---|---|
| What triggers it | A record event (create, edit, field change) | A clock (time, day, date pattern) |
| Records processed | One record at a time (the triggering record) | Multiple records — the function queries and iterates |
| Execution context | Fires in real time when the event occurs | Fires at the configured schedule regardless of events |
| Best for | Real-time responses to individual record changes | Batch operations across many records on a regular schedule |
| Common use cases | Update related record, send notification, calculate field | Nightly cleanup, weekly report, monthly rebalancing |
Setting Up a Scheduled Function in Zoho CRM
- Go to Setup → Developer Space → Functions. Create a new function or open an existing one.
- In the function’s trigger settings, select “Time Based” as the trigger type.
- Set the schedule. Options include: daily at a specific time, weekly on a specific day and time, monthly on a specific date and time, or a custom cron expression for more complex patterns.
- Set the timezone. Schedule times reference the timezone you configure — set it to match your business’s primary timezone.
- Save and activate. The function will next execute at the next occurrence of the configured schedule.
A Complete Scheduled Function: Nightly Overdue Deal Alert
This function runs every weekday morning at 8am. It identifies deals whose close date has passed without being marked Closed Won or Closed Lost, updates a custom “Overdue” field and creates a task for each deal’s owner to take action.
// Scheduled function: processOverdueDeals
// Schedule: Daily at 08:00 (business days)
today = zoho.currentdate;
// Find deals where close date is in the past and deal is still open
criteria = "(Close_Date:less_than:" + today.toString("yyyy-MM-dd") + ")" + " and (Stage:not_equal:Closed Won)" + " and (Stage:not_equal:Closed Lost)";
overdueDeals = zoho.crm.searchRecords("Deals", criteria, 1, 200);
processedCount = 0;
for each deal in overdueDeals {
dealId = deal.get("id");
dealName = deal.get("Deal_Name");
ownerId = deal.get("Owner").get("id");
closeDate = deal.get("Close_Date");
// Mark deal as overdue
updateMap = Map();
updateMap.put("Is_Overdue__c", true);
updateMap.put("Days_Overdue__c", today.daysBetween(closeDate.toDate()));
zoho.crm.updateRecord("Deals", dealId, updateMap);
// Create an action task for the owner (only if no overdue task exists)
taskSubject = "ACTION REQUIRED: Update close date — " + dealName;
taskData = Map();
taskData.put("Subject", taskSubject);
taskData.put("Due_Date", today.toString("yyyy-MM-dd"));
taskData.put("Priority", "High");
taskData.put("Owner", {
"id": ownerId
});
taskData.put("What_Id", {
"id": dealId, "type": "Deals"
});
zoho.crm.createRecord("Tasks", taskData);
processedCount = processedCount + 1;
}
// Log the execution result
info "Processed " + processedCount + " overdue deals on " + today.toString("yyyy-MM-dd");
Key Patterns for Reliable Scheduled Functions
Handle the 200-Record Search Limit
Zoho CRM’s searchRecords function returns a maximum of 200 records per call. If your function needs to process more than 200 records, implement pagination: loop through result pages until you get an empty response.
// Paginated record search pattern
pageNum = 1;
pageSize = 200;
hasMore = true;
while(hasMore) {
records = zoho.crm.searchRecords("Deals", criteria, pageNum, pageSize);
if(records.size() == 0) {
hasMore = false;
} else {
for each record in records {
// process each record here
} pageNum = pageNum + 1;
}
}
Log Execution for Monitoring
Scheduled functions run without a user watching them. Add an info statement at the end of every scheduled function that records what was processed — it appears in the execution log for that function run.
Guard Against Duplicate Processing
If a scheduled function creates records (tasks, activities) and runs daily, it can create duplicates if the condition that triggers creation persists across multiple days. Add a check before creating any record: search for an existing record with the same key attributes and skip creation if one already exists.
Frequently Asked Questions
What is a scheduled function in Zoho CRM?
A scheduled function is a Deluge script that runs automatically at a defined time interval — daily, weekly, hourly or at a specific date/time. It runs without any user trigger, making it suitable for bulk data updates, automated reports and time-based business logic.
What are the most common use cases for scheduled Deluge functions?
Daily pipeline health checks (flag deals with no activity in 14 days), weekly data quality reports (identify records with missing required fields), monthly KPI calculations (update a score field across all active contacts), and automated list cleaning (suppress bounced email addresses).
How do I create a scheduled function in Zoho CRM?
In Zoho CRM: Settings → Developer Space → Scheduled Functions → New Scheduled Function. Write the Deluge script, set the schedule (frequency and time), and activate. The function runs automatically on the defined schedule.
Are there limits on scheduled functions in Zoho CRM?
Yes — Zoho CRM imposes API call limits and execution time limits on scheduled functions. Scripts that process large numbers of records need to be designed to handle pagination and stay within execution limits. ABR builds production-grade scheduled functions with these constraints in mind.
Can ABR build scheduled functions for our Zoho CRM?
Yes — scheduled function development is part of ABR’s Zoho CRM development services. Book a free consultation →
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is a scheduled function in Zoho CRM?","acceptedAnswer":{"@type":"Answer","text":"A scheduled function is a Deluge script that runs automatically at a defined time interval — daily, weekly, hourly or at a specific date/time. It runs without any user trigger, making it suitable for bulk data updates, automated reports and time-based business logic."}},{"@type":"Question","name":"What are the most common use cases for scheduled Deluge functions?","acceptedAnswer":{"@type":"Answer","text":"Daily pipeline health checks (flag deals with no activity in 14 days), weekly data quality reports (identify records with missing required fields), monthly KPI calculations (update a score field across all active contacts), and automated list cleaning (suppress bounced email addresses)."}},{"@type":"Question","name":"How do I create a scheduled function in Zoho CRM?","acceptedAnswer":{"@type":"Answer","text":"In Zoho CRM: Settings → Developer Space → Scheduled Functions → New Scheduled Function. Write the Deluge script, set the schedule (frequency and time), and activate. The function runs automatically on the defined schedule."}},{"@type":"Question","name":"Are there limits on scheduled functions in Zoho CRM?","acceptedAnswer":{"@type":"Answer","text":"Yes — Zoho CRM imposes API call limits and execution time limits on scheduled functions. Scripts that process large numbers of records need to be designed to handle pagination and stay within execution limits. ABR builds production-grade scheduled functions with these constraints in mind."}},{"@type":"Question","name":"Can ABR build scheduled functions for our Zoho CRM?","acceptedAnswer":{"@type":"Answer","text":"Yes — scheduled function development is part of ABR's Zoho CRM development services. Book a free consultation →"}}]}










