--- alias: user-guide-automation-scheduled-action-preconditions description: "Explain how Pre-Conditions restrict Automation Scheduled Action execution by time, date, or custom DEE logic." --- # Pre-Conditions **Pre-Conditions** define when an **Automation Scheduled Action (ASA)** task is allowed to run. They can be out-of-the-box time conditions or custom conditions implemented with DEE rules. After **Context Resolution** selects the target entity instances, **Pre-Conditions** evaluate whether the **ASA** task is permitted to run at the current time or under specific defined rules. **Pre-Conditions** do not evaluate runtime readiness of entity instances. They act as execution guards that restrict when the **Scheduled Action** task can move forward to be evaluated by the **Detectors**. ![Diagram showing the working of the Pre-Conditions within the Scheduled Action flow.](../diagrams/pre_conditions.drawio.svg) ## How It Works 1. The **ASA** task triggers according to its schedule. 2. Each configured **Pre-condition** is evaluated. 3. If all **Pre-Conditions** are satisfied, the flow continues to the **Detectors** to ensure the instance readiness. 4. If at least one **Pre-Condition** is not satisfied, the **ASA** task does not proceed and is evaluated again in the next polling cycle. ## Pre-Condition Options The **Pre-Conditions** section allows you to configure one or more rules, and manage them using the list panel in the wizard. All configured **Pre-Conditions** must evaluate successfully for the **Scheduled Action** to proceed. !!! Warning "Only UTC date and time is considered" All time ranges and days are evaluated according to UTC time, not local time. === "Allowed Time Window" Restricts execution to a specific daily UTC time interval. You must define the start and end time, such as: - Multiple Timeframes: they work as an `OR`, meaning that execution can happen in any of the specified intervals. For example, `12:30-14:30 16:30-18:30`. - Multiple Entries: they work as an `AND`, meaning that execution must happen in the specified intervals. For example, `12:30-14:30` and `14:00-15:00`. - Single Timeframe: execution must happen in the specified interval. For example, `12:30-14:30`. Ideal for: - Maintenance windows - Night operations - Controlled execution during off-peak hours Result: - Returns `True` if current time is inside the configured window. - Otherwise returns `False` and the action waits for the next polling cycle. ![Pre-Conditions tab from the create Automation Scheduled Action wizard](../images/ASC_preconditions_window.png) === "Allowed Weekdays" Restricts execution to specific days of the week. You must select one or more weekdays. Ideal for: - Weekday-only operations - Weekend maintenance restrictions - Business-calendar-based execution Result: - Returns `True` if the current weekday matches the configured list. - Otherwise returns `False` and the **ASA** task waits for the next polling cycle. ![Pre-Conditions tab from the create Automation Scheduled Action wizard](../images/ASC_preconditions_weekday.png) === "DEE Action" Execution is controlled through custom logic implemented in a **DEE action**. Ideal for: - Complex business rules - Calendar logic not covered by standard options - External system validation - Custom time restrictions Specify the **DEE action** you want to use as a **Pre-Condition**. Make sure its inputs and outputs match the DEE contract: | Direction | Key Name | Data Type | Description | |------------|----------|---------------------------------|----------------------------------------------------------| | **Input** | `Task` | `AutomationScheduledActionTask` | Provides context about the current task being validated. | | **Output** | `Result` | `Boolean` | Determines the outcome. `true` = Pass, `false` = Fail. | Table 1: Pre-Condition DEE Contract Result: - Returns `True` to allow execution. - Returns `False` to stop execution and re-evaluate in the next polling cycle. ![Pre-Conditions tab from the create Automation Scheduled Action wizard](../images/ASC_preconditions_dee.png) ## Configuration Steps In the **Create Scheduled Action** wizard: 1. After completing the **General Data** tab, proceed to the **Pre-Conditions** step. 2. Select :material-plus: to create a new **Pre-Condition**. 3. Provide a name and select the Type. 4. Configure the required parameters depending on the selected type. 5. Repeat as needed to combine multiple **Pre-Conditions**. 6. Use the reorder controls if execution sequence matters for readability. 7. Save and proceed to the next section. ![Pre-Conditions tab from the create Automation Scheduled Action wizard](../images/ASC_preconditions_tab.png)