Back to Documentation

Scheduling & Triggers

Scheduling and triggers are fundamental to automating workflows in StepwiseRPA. This guide covers how to set up automated execution of your workflows using various scheduling options and trigger mechanisms.

Overview

StepwiseRPA provides flexible scheduling options that allow you to run workflows automatically based on time schedules, events, or external triggers. This enables you to automate repetitive tasks without manual intervention.

Schedule Types

Time-Based Schedules

Time-based schedules execute workflows at specific times or intervals. You can configure schedules using several patterns:

Cron Expressions

Cron expressions provide the most flexible scheduling option. They allow you to define complex schedules using a standard syntax:

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *

Examples:

  • 0 9 * * * - Every day at 9:00 AM
  • 0 */2 * * * - Every 2 hours
  • 0 0 * * 1 - Every Monday at midnight
  • 30 14 1 * * - First day of every month at 2:30 PM

Simple Intervals

For simpler use cases, you can use interval-based scheduling:

  • Every minute: Execute the workflow every minute
  • Every hour: Execute at the top of each hour
  • Daily: Execute once per day at a specified time
  • Weekly: Execute on specific days of the week
  • Monthly: Execute on specific days of the month

Event-Based Triggers

Event-based triggers execute workflows when specific events occur:

File System Events

  • File Created: Trigger when a new file is added to a monitored directory
  • File Modified: Trigger when a file is updated
  • File Deleted: Trigger when a file is removed

Email Triggers

  • New Email Received: Trigger when an email matching criteria is received
  • Email Subject Contains: Trigger based on email subject patterns
  • Email From: Trigger for emails from specific senders

API Webhooks

  • HTTP POST: Trigger via webhook URL
  • Custom Events: Trigger from external systems via API calls

Creating a Schedule

Step 1: Navigate to Workflow Settings

  1. Open your workflow in the Workflow Builder
  2. Click on the Settings tab
  3. Select Scheduling & Triggers

Step 2: Choose Schedule Type

Select the type of schedule you want to create:

  • Time-based Schedule: For recurring time-based execution
  • Event Trigger: For event-driven execution
  • Manual Only: Disable automatic execution

Step 3: Configure Schedule Details

For Time-Based Schedules:

  1. Select Schedule Pattern:

    • Choose between Cron expression or Simple interval
    • If using Cron, enter your expression
    • If using Simple interval, select the frequency
  2. Set Timezone:

    • Choose the timezone for schedule execution
    • Defaults to your account timezone
  3. Set Start Date (optional):

    • Specify when the schedule should begin
    • Leave empty to start immediately
  4. Set End Date (optional):

    • Specify when the schedule should stop
    • Leave empty for indefinite execution

For Event Triggers:

  1. Select Event Type:

    • Choose from available event types
    • Configure event-specific parameters
  2. Set Filters:

    • Define conditions that must be met
    • Use pattern matching for file names or email subjects
  3. Set Monitoring Path (for file events):

    • Specify the directory to monitor
    • Supports local paths and cloud storage

Advanced Scheduling Options

Conditional Execution

You can add conditions to schedules to control when workflows execute:

// Example: Only run on weekdays
if (dayOfWeek !== 'Saturday' && dayOfWeek !== 'Sunday') {
  executeWorkflow();
}

Schedule Groups

Group related schedules together for easier management:

  • Sequential Execution: Run workflows in a specific order
  • Parallel Execution: Run multiple workflows simultaneously
  • Dependency Management: Define workflow dependencies

Retry Logic

Configure retry behavior for scheduled workflows:

  • Maximum Retries: Number of retry attempts
  • Retry Interval: Time between retry attempts
  • Exponential Backoff: Gradually increase retry intervals

Monitoring Scheduled Workflows

Execution History

View the execution history of scheduled workflows:

  1. Navigate to Workflows > Schedules
  2. Select your scheduled workflow
  3. View execution logs and status

Status Indicators

  • Active: Schedule is active and will execute
  • Paused: Schedule is temporarily disabled
  • Failed: Last execution failed (check logs)
  • Completed: Schedule has finished (if end date set)

Notifications

Configure notifications for schedule events:

  • Execution Started: Notify when workflow begins
  • Execution Completed: Notify on successful completion
  • Execution Failed: Notify on errors or failures

Best Practices

1. Use Appropriate Schedule Frequencies

  • Don't schedule workflows more frequently than necessary
  • Consider the processing time of your workflow
  • Account for system load and resource usage

2. Implement Error Handling

Always include error handling in scheduled workflows:

  • Use try-catch blocks for critical operations
  • Log errors for debugging
  • Set up alerts for critical failures

3. Monitor Resource Usage

  • Track execution times
  • Monitor system resources
  • Optimize workflows that run frequently

4. Use Timezone Awareness

  • Always specify timezones explicitly
  • Consider daylight saving time changes
  • Test schedules across different timezones

5. Document Your Schedules

  • Add descriptions to schedules
  • Document the purpose and expected behavior
  • Include any dependencies or prerequisites

Common Use Cases

Daily Report Generation

Schedule: 0 8 * * * (Every day at 8:00 AM)

Generate and email daily reports automatically.

File Processing

Trigger: File Created in /incoming/orders/

Process new order files as they arrive.

Data Synchronization

Schedule: 0 */6 * * * (Every 6 hours)

Synchronize data between systems every 6 hours.

Weekly Cleanup

Schedule: 0 2 * * 0 (Every Sunday at 2:00 AM)

Perform weekly maintenance and cleanup tasks.

Troubleshooting

Schedule Not Executing

  1. Check Schedule Status: Ensure the schedule is active
  2. Verify Timezone: Confirm timezone settings are correct
  3. Check Permissions: Ensure the workflow has necessary permissions
  4. Review Logs: Check execution logs for errors

Workflow Executing at Wrong Time

  1. Verify Timezone: Check timezone configuration
  2. Check Cron Expression: Validate cron syntax
  3. Account for DST: Consider daylight saving time changes

High Resource Usage

  1. Review Schedule Frequency: Reduce execution frequency if possible
  2. Optimize Workflow: Improve workflow efficiency
  3. Consider Off-Peak Hours: Schedule during low-usage periods

Related Documentation