Welcome to Zuora Product Documentation

Explore our rich library of product information

Time: Delay

This reference describes the Time: Delay task.

The "Time: Delay" task performs a specified time delay for a workflow. You can define the delay time in seconds in the task settings.

Delay task configuration

Example

The following steps provide an example of using the Delay task to set up retry logic.
  1. For the task that you want to retry (for example, SFTP task), create a Failure branch, and add an If task.

  2. For the If task, specify the logic to determine whether the predefined number of retries is reached and, if not, calculate the next wait time. The following code block increments the retry count by one and calculates the wait time (waitSeconds). For each new retry, the backOff variable will have a new value.

    {%- if Data.Liquid.retryCount == nil -%}
      {%- assign retryCount = 1 -%}
      {%- assign backOff = GlobalConstants.backOffMultiplier |
            plus: 0.00 -%}
    {%- else -%}
      {%- assign retryCount = Data.Liquid.retryCount |
            plus: 1 -%}
      {%- assign backOff = Data.Liquid.backOff |
            times: GlobalConstants.backOffMultiplier -%}
    {%- endif -%}
    {% if retryCount <= 3 %}
      {%- assign waitSeconds = GlobalConstants.retryMinutes |
            times: 60.0 | times: backOff -%}
    True
    {% else %}
    False
    {% endif %}
  3. Add a Delay task after the If task, and connect the Success branch of the Delay task to the start of the SFTP task to complete the loop. The Delay task performs a time delay that is equal to the wait time (waitSeconds) calculated in the If task (step 2). Set the delay time of the task with the following Liquid expression:

    {{Data.Liquid.waitSeconds}}

    For the name of the task, you can also include this Liquid expression so that the actual number of minutes for each retry will be recorded in the task run.

    Wait for {{Data.Liquid.waitSeconds | divided_by: 60}} mins