Flow Designer

Trigger a Flow on a Schedule

Scheduled flows run automatically on recurring intervals without human intervention or record changes. This guide walks you through creating one and handling the data context differences that trip up most developers.

Why scheduled flows exist

Before scheduled flows, automating recurring tasks meant writing Scheduled Jobs (sys_trigger records) with server-side JavaScript or creating workflows with timer activities. Platform admins and developers had to maintain code that was hard to test and debug. Scheduled flows give you the visual Flow Designer interface for recurring automation, which means better maintainability and easier troubleshooting when things break.

How scheduled flows work differently

A scheduled flow has no trigger record context — there's no 'current' incident or user triggering it. Instead, you explicitly query tables for the records you want to process. The schedule trigger fires the flow, then you use Data Lookups or For Each actions to find and iterate through records. Think of it as a container that runs on schedule, not an event-driven flow that reacts to changes.

Building production-quality scheduled flows

Start with a simple daily or weekly schedule and basic queries. Add error handling with Try/Catch blocks, logging with Flow Variables to track what processed, and conditions to prevent runaway processing. Advanced implementations use custom tables to track execution history, implement circuit breakers for long-running processes, and include retry logic for failed operations.

Before you start

  • admin role or flow_designer role
  • Table access to any tables the flow will query
Sourdough
Chrome Extension

Sourdough: ServiceNow Monitoring and Analytics

A Chrome extension for ServiceNow Admins and Developers with essential tools, analytics, graphs and monitoring features.

Instance HealthGraphs & ChartsAPI HealthDeveloper ToolsQuick SearchInstance Switcher
Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Step by step

1

Create a new flow

Navigate to Process Automation > Flow Designer and click New. Give your flow a name that indicates it's scheduled — include 'Daily', 'Weekly', or the frequency in the name. Set the Application scope to your custom application, not Global.

TIP

Name scheduled flows with their frequency so other admins know what they do at a glance.

2

Configure the Schedule trigger

Click the trigger and select Schedule from the trigger type dropdown. Set Run to 'Periodically' for simple intervals or 'According to a schedule' for cron expressions. For Periodically, choose your frequency — Daily, Weekly, or specify hours/minutes. For cron schedules, use standard cron syntax like '0 2 * * *' for 2 AM daily.

TIP

Test with a short interval first (every 5 minutes) to verify the flow works, then change to your production schedule.

3

Set the data source table

In the Schedule trigger configuration, set the Table field to the primary table your flow will work with. This doesn't limit your queries but helps with scoping and permissions. If you're processing incidents, choose Incident. If you're working with multiple unrelated tables, choose Task or leave it blank.

TIP

The Table setting affects which Flow Variables are available in the Flow Designer interface.

4

Add your data lookup action

Click the + icon after the trigger and add a Data action. Choose 'Look Up Records' to query for the data you want to process. Set your table, conditions, and any limits. Since there's no trigger record context, all your query conditions must be explicit — you can't reference 'Current record' values.

TIP

Always include a limit on your lookup to prevent runaway queries that process thousands of records.

5

Handle the results with iteration

Add a 'For Each' action after your data lookup to process each record individually. Connect the Data Lookup output to the For Each input list. Inside the For Each loop, add your business logic actions — Update Record, Create Record, Send Email, etc.

TIP

Process records individually in For Each loops rather than trying to bulk update — it's more reliable and easier to debug.

6

Add error handling and activate

Wrap your For Each loop in a Try/Catch action to handle errors gracefully. In the Catch block, log errors or send notifications to admins. Test the flow manually using the Test button, then activate it by toggling the Active switch in the flow properties.

Best practices

  • Always include record limits in your data lookups — scheduled flows can easily overwhelm the system if they process too many records.

  • Use Flow Variables to log what your scheduled flow processed so you can troubleshoot when something doesn't run as expected.

  • Set reasonable schedules based on your data volume — don't run hourly if daily is sufficient, and avoid peak business hours for heavy processing.

  • Include conditions to prevent duplicate processing, like checking if a record was already processed today using a flag field or last modified date.

  • Wrap scheduled flows in Try/Catch blocks and send error notifications to admins — unlike user-triggered flows, nobody's watching when these fail.

Test Your Knowledge

Quick 3-question quiz — see how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue