在 Azure 逻辑应用中延迟运行下一操作Delay running the next action in Azure Logic Apps

若要在运行下一操作之前让逻辑应用等待一定的时间,可以在逻辑应用的工作流中的某个操作之前添加内置的“延迟 - 计划” 操作。To have your logic app wait an amount of time before running the next action, you can add the built-in Delay - Schedule action before an action in your logic app's workflow. 也可添加内置的“延迟截止时间 - 计划”操作,等到特定的日期和时间过后再运行下一操作。 Or, you can add the built-in Delay until - Schedule action to wait until a specific date and time before running the next action. 有关内置“计划”操作和触发器的详细信息,请参阅使用 Azure 逻辑应用计划和运行定期自动执行的任务和工作流For more information about the built-in Schedule actions and triggers, see Schedule and run recurring automated, tasks, and workflows with Azure Logic Apps.

  • 延迟:等待指定的时间单位数(例如秒数、分钟数、小时数、天数、周数或月数),然后运行下一操作。Delay: Wait for the specified number of time units, such as seconds, minutes, hours, days, weeks, or months, before the next action runs.

  • 延迟截止时间:等到指定的日期和时间,然后运行下一操作。Delay until: Wait until the specified date and time before the next action runs.

下面是一些演示如何使用这些操作的示例方式:Here are some example ways to use these actions:

  • 等到工作日通过电子邮件发送状态更新。Wait until a weekday to send a status update over email.

  • 在恢复和检索数据前,延迟工作流直到 HTTP 调用完成。Delay your workflow until an HTTP call finishes before resuming and retrieving data.

先决条件Prerequisites

  • Azure 订阅。An Azure subscription. 如果没有订阅,可以注册 Azure 试用帐户If you don't have a subscription, you can sign up for a trial Azure account.

  • 有关逻辑应用的基本知识。Basic knowledge about logic apps. 在使用操作之前,必须先使用触发器启动逻辑应用。Before you can use an action, your logic app must first start with a trigger. 在添加延迟操作之前,可以使用任何所需的触发器并添加其他操作。You can use any trigger you want and add other actions before you add a delay action. 本主题使用 Office 365 Outlook 触发器。This topic uses an Office 365 Outlook trigger. 如果不熟悉逻辑应用,请了解如何创建第一个逻辑应用If you're new to logic apps, learn how to create your first logic app.

添加延迟操作Add the Delay action

  1. 在逻辑应用设计器中,请在要添加延迟操作的步骤下选择“新建步骤” 。In the Logic App Designer, under the step where you want to add the delay action, choose New step.

    若要在步骤之间添加延迟操作,请将指针移动到连接这些步骤的箭头之上。To add the delay action between steps, move the pointer over the arrow that connects the steps. 选择出现的加号 (+),然后选择“添加操作”。 Choose the plus sign (+) that appears, and then select Add an action.

  2. 在搜索框中,输入“延迟”作为筛选器。In the search box, enter "delay" as your filter. 在操作列表中选择此操作:延迟From the actions list, select this action: Delay

    添加“延迟”操作

  3. 指定下一操作运行前需要等待的时间。Specify the amount of time to wait before the next action runs.

    设置延迟的时间

    属性Property JSON 名称JSON name 必须Required 类型Type 说明Description
    计数Count countcount Yes IntegerInteger 要延迟的时间单位数The number of time units to delay
    计价单位Unit unitunit Yes StringString 时间单位,例如:SecondMinuteHourDayWeekMonthThe unit of time, for example: Second, Minute, Hour, Day, Week, or Month
  4. 添加需要在工作流中运行的任何其他操作。Add any other actions that you want to run in your workflow.

  5. 完成后,保存逻辑应用。When you're done, save your logic app.

添加“延迟截止时间”操作Add the Delay-until action

  1. 在逻辑应用设计器中,请在要添加延迟操作的步骤下选择“新建步骤” 。In the Logic App Designer, under the step where you want to add the delay action, choose New step.

    若要在步骤之间添加延迟操作,请将指针移动到连接这些步骤的箭头之上。To add the delay action between steps, move the pointer over the arrow that connects the steps. 选择出现的加号 (+),然后选择“添加操作”。 Choose the plus sign (+) that appears, and then select Add an action.

  2. 在搜索框中,输入“延迟”作为筛选器。In the search box, enter "delay" as your filter. 在操作列表中选择此操作:延迟截止时间From the actions list, select this action: Delay until

    添加“延迟截止时间”操作

  3. 提供结束日期和时间,以便确定何时需要继续该工作流。Provide the end date and time for when you want to resume the workflow.

    指定何时结束延迟的时间戳

    属性Property JSON 名称JSON name 必须Required 类型Type 说明Description
    TimestampTimestamp timestamptimestamp Yes StringString 结束日期和时间(用于继续工作流),采用以下格式:The end date and time for resuming the workflow using this format:

    YYYY-MM-DDThh:mm:ssZYYYY-MM-DDThh:mm:ssZ

    例如,如果所需时间为 2017 年 9 月 18 日下午 2:00,请指定“2017-09-18T14:00:00Z”。So for example, if you want September 18, 2017 at 2:00 PM, specify "2017-09-18T14:00:00Z".

    注意: 此时间格式必须遵循 ISO 8601 日期时间规范,采用 UTC 日期时间格式但没有 UTC 时差Note: This time format must follow the ISO 8601 date time specification in UTC date time format, but without a UTC offset. 如果没有时区,必须在末尾添加字母“Z”(无空格)。Without a time zone, you must add the letter "Z" at the end without any spaces. 这个“Z”指等效的航海时间This "Z" refers to the equivalent nautical time.

  4. 添加需要在工作流中运行的任何其他操作。Add any other actions that you want to run in your workflow.

  5. 完成后,保存逻辑应用。When you're done, save your logic app.

后续步骤Next steps