## Related terms

- workflow\-scheduler
- schedule\-rule
- workflow
- node
- event
- automation\-module

See the [glossary](/glossary.md) for definitions.

---

# Workflow scheduler


A workflow scheduler is a feature that you can use when creating a workflow (it becomes available after adding the first node on the canvas). It lets you create a set of rules which automatically change the workflow status. There are two types of rules:

- **One time**: the rule changes the workflow status once, at a selected date and time.
- **Repeatable**: the rule changes the workflow status on a recurring schedule, for example, every day at 07:00. Repeatable rules are available for the **Activate** and **Pause** actions. You can add multiple repeatable rules to one workflow, for example, to activate the workflow every morning and pause it every evening.

This feature is helpful when you need to activate a workflow at a later date, when a workflow must run only in defined hours (for example, during business hours), or when you're handling multiple workflows and want to avoid the hassle of remembering when to change their status.

The workflow can receive the following statuses:

- **Pending**: A workflow which is scheduled to be activated on a future date. A pending workflow can be run or stopped.
- **Active**: A workflow will perform operations when its trigger conditions are met. The workflow remains active until you manually stop it or 62 days have passed since the last trigger. An active workflow can also be paused or stopped.
- **Paused**: A workflow is temporarily paused. In a customer-oriented workflow, customers are paused at their current stage, while in a business-oriented workflow, the processes are paused at their current stage. A paused workflow can be re-activated and stopped permanently. When re-activated, the customers and processes will resume from where they left off.
- **Stopped**: A workflow is permanently stopped. In a stopped workflow, customers and processes complete the workflow from their current stage. A stopped workflow cannot be paused or re-activated.

The following logic is allowed: 
- Draft > Pending > Active
- Draft > Active > Pause > Stop

### Difference between scheduler and Scheduled Run node

The workflow scheduler feature allows you to automate workflow status changes (active, paused, stopped) based on a schedule you set. On the other hand, the ["Scheduled Run" node](/docs/automation/triggers/scheduled-run) serves as a workflow trigger that specifies the date and time for starting the defined process within the workflow, as long as the workflow is active.

Repeatable schedule rules don't launch the process defined in the workflow. They only change the status of the workflow on a recurring schedule. To launch a process on a recurring schedule, use the **Scheduled Run** node with the **Repeat runs** option.

### Important

- Schedule rules are part of a [workflow version](/docs/automation/workflow-versioning). Only the schedule rules of the Public version apply. When you set another version as Public, the schedule rules of the previous Public version stop working, and the schedule rules of the new Public version apply. In a version which isn't Public, you can edit schedule rules, but you can't turn them on.
- Resuming stopped workflows is impossible, however, you can duplicate the stopped workflow and activate the duplicate;  
- The scheduler does not validate whether rules overlap or whether their execution order is correct. As a result, it is your responsibility to ensure that all defined rules align with your business logic and do not produce unintended outcomes. Before running the scheduler, carefully review your configuration to make sure the rules behave as expected.
- If you resume a paused workflow, then:  
    - if a profile paused at the ["Delay" node](/docs/automation/flow-control/delay-node) and the workflow is resumed before the delay time passes, a profile will continue the journey,
    - if a profile paused at the ["Event Filter" node](/docs/automation/conditions/client-event-filter-node) and there is no time limit or the time limit isn't exceeded, the journey will continue if the event defined in the filter occurs,
    - if a profile paused at the ["ABx Test" node](/docs/automation/conditions/abx-split-node), ["Metric Filter" node](/docs/automation/conditions/metric-filter-node), ["Flow Limiter" node](/docs/automation/conditions/flow-limiter), or ["Delay" node](/docs/automation/flow-control/delay-node), and the node received a response (for example, metric result has been received) before pausing, a profile will stuck in the journey or an [automation.clientPathAborted](/docs/assets/events/event-reference/automation#automationclientpathaborted) event will be generated and the profile finishes the journey.
    - the possibility of pausing at the action node is slim
- When the status of the workflow is changed by the scheduler, the system validates the workflow diagram. If any part of the diagram has been removed (for example, a segmentation used in the **Audience** node has been removed from the workspace), the rule will be skipped and the scheduler will make an attempt to execute the next rule according to the timeline. 

## Creating schedule rules

1. Go to **Automation Hub > Workflows** and do one of the following:
    - To create a new workflow, click **New workflow** and prepare the workflow you want to launch.  
    To learn basics on how to create a workflow, refer to the [Creating workflows](/docs/automation/creating-automation) article.
    - To add schedule rules to an existing workflow, including a running one, click the workflow on the list.
2. In the upper-right corner of the canvas, click **Define scheduler**.  
    - In a new workflow, this option appears after adding the first node.
    - If the workflow already has schedule rules, this option is named **Scheduler rules**.
    <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/define-scheduler-option.png" class="medium" alt="Define scheduler option"><figcaption>Define scheduler option</figcaption></figure>  

    **Result**: A pop-up appears.  
    <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/define-scheduler-popup.png" class="large" alt="A blank workflow scheduler configuration"><figcaption>A blank workflow scheduler configuration</figcaption></figure>  

3. Click **Add rule**.  
4. From the dropdown list, select the action to be performed:  
    - Activate
    - Pause
    - Stop
5. To define details of the schedule rule, click it.  
6. From the dropdown list, select the type of the rule.  
    For the **Stop** action, only one-time rules are available, so the dropdown list isn't displayed. Go directly to selecting the date and time.

    
   <div class="content-tabs" data-tab-group="tabgrp-1410">
   <div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-1410-0" data-tab-group="tabgrp-1410" data-tab-active="true">One time</button><button class="tab-button" data-tab-id="tabgrp-1410-1" data-tab-group="tabgrp-1410">Repeatable</button></div>

   <div class="tab-panel" data-tab-id="tabgrp-1410-0" data-tab-group="tabgrp-1410" data-tab-active="true">

   In the date field, select the date and time when the workflow changes its status to the one defined by the rule you're creating.  
   <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/example-schedule-rule.png" class="large" alt="Example of a one-time schedule rule"><figcaption>Example of a one-time schedule rule</figcaption></figure>

   </div>

   <div class="tab-panel" data-tab-id="tabgrp-1410-1" data-tab-group="tabgrp-1410">

   1. In the **from** and **to** fields, select the dates between which the rule is executed.  
       The **to** field is optional. If you leave it empty, the rule has no end date.
   2. Select the tab with the recurrence pattern and configure it:
       - **Daily**: The rule is executed every day. In the time field, select the time when the workflow changes its status. To execute the rule more than once a day, click **Add time** and select another time.
       - **Weekly**: The rule is executed on the selected days of the week. Select the days, click **Add time**, and select the time when the workflow changes its status. You can add more than one time.
       - **Monthly**: The rule is executed on the selected days of the month. Select the days, click **Add time**, and select the time when the workflow changes its status. You can add more than one time.  
       If you select the 29th, 30th, or 31st, the rule is skipped in months that don't have that day. For example, a rule set for the 31st isn't executed in February, April, June, September, and November.
       - **Custom period**: The rule is executed at a fixed interval. Next to **Every**, enter a number and select the unit: **Hour**, **Day**, or **Week**. For example, 2 Day means that the rule is executed every two days. In the **beginning at** field, select when the rule is executed for the first time.

       On the **Weekly** and **Monthly** tabs, you can select or clear all days at once by clicking **Select all** or **Unselect all**.  
   <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/scheduler-repeatable-rule.png" class="large" alt="Repeatable Activate rule with the from and to date fields, the Daily, Weekly, Monthly, and Custom period tabs, and a time field set to 00:00"><figcaption>Configuration of a repeatable rule</figcaption></figure>

   </div>
   </div>


    **Result**: A rule is added.
7. To add more rules, repeat steps 3-6.  
    The transition between statuses will be performed according to the dates and recurrence patterns of the rules.
8. To preview the scheduled statuses for the workflow, click the **Statuses** tab.  
    If you create two or more subsequent rules for the same action, the status only changes once and is visible only once on the **Statuses** tab.  
    
   <div class="content-tabs" data-tab-group="tabgrp-1411">
   <div class="tab-buttons"><button class="tab-button" data-tab-id="tabgrp-1411-0" data-tab-group="tabgrp-1411" data-tab-active="true">Statuses tab</button><button class="tab-button" data-tab-id="tabgrp-1411-1" data-tab-group="tabgrp-1411">Actions tab</button></div>

   <div class="tab-panel" data-tab-id="tabgrp-1411-0" data-tab-group="tabgrp-1411" data-tab-active="true">

   <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/scheduler-twice-run-status.png" class="large" alt="One Active status"><figcaption>One Active status</figcaption></figure>

   </div>

   <div class="tab-panel" data-tab-id="tabgrp-1411-1" data-tab-group="tabgrp-1411">

   <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/scheduler-run-twice.png" class="large" alt="Two Activate actions"><figcaption>Two Activate actions</figcaption></figure>

   </div>
   </div>
  
9. To preview the actions which will be executed in the context of the workflow, click the **Actions** tab.  
    Actions correspond to the statuses scheduled for the workflow. 

10. By navigating through **Prev** and **Next**:
    - on the **Statuses** tab, you can preview upcoming statuses;
    - on the **Actions** tab, you can preview executed and planned actions.
11. From the **Timezone** dropdown list, select the timezone for which the rules will be interpreted.
12. Confirm by clicking **Apply**. 
13. Save the workflow by clicking **Save**.  
    To activate a draft workflow with schedule rules, see [Activating workflow with scheduled rules](#activating-workflow-with-scheduled-rules).

### Example: Workflow active during business hours

To keep a workflow active only between 07:00 and 19:00 every day, create two repeatable rules with the **Daily** recurrence pattern:

- **Activate** at 07:00
- **Pause** at 19:00

The **Pause** action deactivates the workflow for the night, and the **Activate** action resumes it in the morning. To end the workflow permanently at a specific date, you can add a one-time **Stop** rule.

## Activating workflow with scheduled rules

The following instructions concern a scenario in which a draft workflow is activated.

- to save it as a draft, click **Save**.
- to save and activate it by enabling: **Run workflow immediately**, or  **Activate schedule rules**, or combine these options. The table below presents outcome for every combination:

    | Run workflow immediately | Activate schedule rules | Outcome |
    |--------------------------|--------------------------|---------|
    | + | - |  The schedule rules will be disabled, the workflow will be immediately activated; any status changes will need to be done manually.       |
    | - | + |   The workflow will remain in a Pending status until the scheduled activation date, and it will then proceed according to the schedule rules.       |
    | + | + |  The workflow will be immediately set to Active status, and the schedule rules will be enforced; if the first schedule rule is activation, it will be ignored since the workflow will already be active at that time.       |

- check the version in the **Version to run** section. The pop-up shows the version that will run. This is always the Public version.
- optionally, to preview the status changes that the schedule rules will make, click **Upcoming statuses**.
- confirm your choice by clicking **Yes, run workflow**.  

    <figure><img src="/api/docs/image/219f337699cf7b17198d03b7a7c7f148886e25a1/docs/automation/_gfx/activate-workflow-schedule-rules.png" class="medium" alt="The Run workflow pop-up with the version to run and the Run workflow immediately and Activate schedule rules toggles"><figcaption>A pop-up that appears after clicking Save & Run for a workflow with schedule rules</figcaption></figure>


