> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumos.com/llms.txt
> Use this file to discover all available pages before exploring further.

# "Wait Until" Step

## Overview

Use the **Wait Until** step to pause a workflow until a specific date/time is reached, like an employee's Start Date. This is useful when your workflow triggers as soon as an identity/account is detected, but downstream actions must happen on or relative to a given date (e.g., employee start date).

***

## Why This Matters

In many environments, HRIS sync timing and identity creation timing vary. If you use a static wait like "wait 7 days," the same workflow can run too early or too late depending on when it triggered. Wait Until solves this by waiting until a computed timestamp such as:

* Start Date (exact)
* Start Date minus X days (pre-provisioning)
* Start Date plus X days (post-start cleanup)

***

## How It Works

1. The workflow reaches the Wait Until step.
2. Lumos evaluates the configured date/time (Start Date plus any offsets).
3. The workflow pauses until that moment.
4. When the timestamp is reached, the workflow resumes and continues to the next step.

**Note:** If the computed timestamp is earlier than the current time, the workflow skips the wait and continues immediately to the next step.

***

## Configure the Wait Until Step

### Step 1: Add the Step

In your workflow builder, add a step named **Wait Until**.

### Step 2: Choose the Base Date Attribute

Set the desired date found for the target identity.

### Step 3: (Optional) Add an Expression (LEL)

Use **Lumos Expression Language (LEL)** to add offsets and calculations.

### Supported date arithmetic functions:

| | |
| - | - |
| Function | Description |
| `add_days(datetime, number)` | Adds the specified number of days to the datetime |
| `subtract_days(datetime, number)` | Subtracts the specified number of days from the datetime |
| `add_hours(datetime, number)` | Adds the specified number of hours to the datetime |

**Notes:**

* Date functions are null-safe: if the input is missing (`None`), the result is `None`.
* The first argument must be a datetime value.
* Negative values are supported (e.g., `add_days(start_date, -3)` is equivalent to `subtract_days(start_date, 3)`).
* Your expression must be valid to save the step configuration.

### Common examples:

| | |
| - | - |
| Goal | Expression |
| Wait until start date | `start_date` |
| Wait until 3 days after start date | `add_days(start_date, 3)` |
| Wait until 7 days before start date | `subtract_days(start_date, 7)` |
| Wait until 9 hours after start date | `add_hours(start_date, 9)` |

***

## Error Handling

If the workflow cannot compute a valid wait timestamp (for example, the Start Date is missing), Lumos will create an **Error Task**.

When the Error Task is created, configure what should happen next:

* **Cancel** — Cancel the workflow
* **OK** — Skip the Wait Until step and continue

***

## Example Scenarios

### MFA Security-Question Window

**Goal:** On Okta account creation, wait until the employee start date to provision an Okta group enabling security-question MFA, then remove that group 3 days after start date.

**Workflow structure:**

1. Okta account created
2. Wait Until: `start_date`
3. Provision Okta group: "Security Questions MFA"
4. Wait Until: `add_days(start_date, 3)`
5. Deprovision Okta group

***

### Split Onboarding Process (Immediate + Start-Date-Relative)

**Goal:** Create some accounts immediately when the identity is created, then provision other apps X days before start date.

**Workflow structure:**

1. Identity created
2. Create ServiceNow account (immediate)
3. Wait Until: `subtract_days(start_date, X)`
4. Provision other applications

***

## Troubleshooting

| | |
| - | - |
| Symptom | Likely Cause |
| The workflow didn't wait | The computed timestamp was in the past, so the workflow proceeded immediately. |
| The step created an Error Task | The base date (Start Date) or expression result was missing or invalid. Check the identity's Start Date value and verify the expression. |
| The resume time looks "off" | Confirm the selected timezone for evaluation matches how your organization interprets Start Date. |
