Skip to main content

Scheduled Triggers in Torq: Predefine Execution Timing

Learn how to schedule workflow executions for precise dates and times.

Updated over a week ago

Use a schedule trigger in Torq when you need a workflow to run at specific dates or times. Common scenarios include:

  • Managing user onboarding/offboarding on a recurring basis, such as weekly tasks.

  • Conducting daily threat intelligence feed queries.

Setting Up a Schedule Trigger

  1. Select the Schedule trigger option for the workflow.

    • For new workflows: Select Create Workflow from the Workflows page and opt for the Schedule trigger.

    • For existing workflows: Click the replace button above the trigger and opt for the Schedule trigger.

  2. Define the trigger frequency, with sub-options adjusting based on your selection.

  3. Specify the trigger time.

The trigger event will include a timestamp for reference.

Execution Point Alignment

When you create, edit, or publish a scheduled workflow in Torq, the system automatically realigns the next execution point. Instead of always running at fixed, universal times, the schedule shifts to align with the moment of creation or the most recent update.
For example, if you set up or republish a workflow at 16:23 with a 30-minute interval, the next run won’t happen at the nearest half-hour mark (16:30). Instead, it will run 30 minutes after the publish time, at 16:53.

If you edit and republish repeatedly, each publish shifts the next execution point further out in sequence.

Smart Scheduling with Nested Workflows

Sometimes you may need a scheduled workflow that runs on a more customized schedule, for example, once every hour, but only during working hours on weekdays.

While the standard Schedule trigger in Torq doesn’t support this level of granularity directly, you can easily achieve it using a nested workflow approach.

How It Works

The idea is to use two workflows:

  1. A nested workflow that determines whether the workflow should run (based on working hours, days, and time zone).

  2. A parent workflow with a standard Schedule trigger that executes every hour and checks the nested workflow’s result before continuing.

Create the Nested Workflow

  1. Define Workflow Parameters: In a Parameters Utility step, add parameters for:

    • Working hours (e.g., 09:00–17:00)

    • Working days (e.g., Monday–Friday)

    • Time zone

  2. Build the Logic: The workflow should evaluate the current time and return either:

    • true : Within working hours/days

    • false : Outside working hours/days

  3. Output: The nested workflow returns a simple boolean (true/false).

Set Up the Parent Workflow

  1. Add a Schedule Trigger: Configure the out-of-the-box Schedule trigger to run every 1 hour.

  2. Call the Nested Workflow: As the first step, use the nested workflow to check if it should run now.

  3. Conditional Execution:

    • If the nested workflow returns true, continue the parent workflow.

    • If it returns false, stop the workflow.

Did this answer your question?