Is this article helpful?

Fail at end of period

Use this scenario when files are expected to arrive within a specific time period and the task should fail if the expected files are not received before the waiting period expires.

This pattern extends the Repeat until first success scenario by adding a validation step that checks whether any files were collected during the Repeat step.

How It Works

The task repeatedly checks the source location for files.

The Repeat step exits successfully when either:

  • The expected number of files is found.
  • The configured time limit is reached.

After the Repeat step exits, a Custom Script step verifies that files were found.

  • If the expected files were collected, the task continues.
  • If no files were collected before the time limit expired, the script throws an error and the task fails.

Configure the Task

  1. Configure the task as described in Repeat until first success.

  2. Add a Custom Script step immediately after the Repeat step to validate the results of the Repeat operation. If no files were collected before the configured timeout period expired, the script should throw an error and fail the task.

    The following example script checks whether any files were returned by the Repeat step:

powershell
$items = @(Get-MftItem)

if ($items.Count -eq 0) {
    throw "Expected files were not found"
}
  1. Configure the remaining task steps as required by your workflow.

This allows the task to wait for files during a defined period while ensuring that missing deliveries are reported as failures.

In this article
How It WorksConfigure the Task