向流添加条件Add a condition to a flow

指定仅在符合条件的情况下,某个流才执行一个或多个任务。Specify that a flow performs one or more tasks only if a condition is true. 例如,指定仅在推文包含的关键字被反复推送至少 10 次的情况下,用户才会收到电子邮件。For example, specify that you'll get an email only if a tweet that contains a keyword is retweeted at least 10 times.

先决条件Prerequisites

添加条件Add a condition

  1. Microsoft Flow 的顶部导航栏中选择“我的流”。In Microsoft Flow, select My flows in the top navigation bar.

    如果尚未登录,则可能需要登录。You might need to sign in if you're not already signed in.

  2. 在流的列表中,选择一个已创建的流。In the list of flows, select one of the flows that you've created.

    此教程采用一个含 Twitter 触发器和 SharePoint 操作的示例。This tutorial uses an example with a Twitter trigger and a SharePoint action.

  3. 选择“编辑流”。Select Edit flow.

  4. 在上一个操作下,选择“新建步骤”。Under the last action, select New step.

  5. 选择“添加条件”。Select Add a condition.

    “条件”按钮

  6. 在“条件”卡上,选择左侧框中的空区域。On the Condition card, select an empty area in box on the left.

    此时会打开“动态内容”列表。The Dynamic content list opens.

  7. 选择“转推计数”参数将其添加到方框中。Select the Retweet count parameter to add it to the box.

  8. 在“条件”卡中间的框中,选择“大于或等于”。In the box in the middle of the Condition card, select is greater than or equal to.

  9. 在右侧的框中输入 10。In the box on the right, enter 10.

    包含参数的“对象名称”框

  10. 选择要在条件内使用的操作的标题(如“创建项目”)并将其拖动到“如果是”文本下方。Select the header of the action you want to use inside the condition (such as Create item) and drag it underneath the text that reads If yes.

    释放光标时,操作移入该框内。When you release the cursor, the action moves into that box.

    拖动操作

  11. 根据需要配置操作。Configure the action as necessary.

  12. 保存流。Save the flow.

在高级模式下编辑Edit in advanced mode

还可以选择“在高级模式中进行编辑”来编写更多高级条件。You can also select Edit in advanced mode to write more advanced conditions. 可以使用高级模式下“工作流定义语言”中的任何表达式。You can use any expression from the Workflow definition language in advanced mode. 了解所有可用表达式Learn about all available expressions.

后续步骤Next steps

了解如何在高级模式的条件中使用表达式Learn how to use expressions in conditions in advanced mode.