带有用户输入的按钮流简介Introducing button flows with user input

创建按钮流能够仅仅点击一个按钮即可运行日常任务。Create a button flow to run routine tasks by simply tapping a button. 通过允许用户提供要在流运行时使用的特定详细信息,来自定义你的流。Customize your flow by allowing the user to provide specific details that will be used when the flow runs. 本主题将指导你完成创建一个用于获取用户输入的按钮流,然后运行该按钮流,并突出显示如何提供用户输入。This topic walks you through creating a button flow that takes input from the user and then running the button flow, highlighting how to provide the user input.

可以在 Microsoft Flow 网站或 Microsoft Flow 的移动应用中创建按钮流。You can create a button flow in the Microsoft Flow website or the mobile app for Microsoft Flow. 对于本主题,我们将使用网站。For this topic, you'll use the website.

先决条件Prerequisites

  • Microsoft Flow 网站上的帐户。An account on the Microsoft Flow website.

打开模板Open the template

  1. 登录到 Microsoft Flow 网站,在搜索框中输入 Visual Studio,然后单击或点击搜索图标,以查找与 Visual Studio 相关的所有模板:Sign in to the Microsoft Flow website, enter Visual Studio in the search box, and then click or tap the search icon to find all templates that relate to Visual Studio:

  2. 选择“在 Visual Studio 中打开优先级为 2 的 Bug”模板:Select the Open a Priority 2 Bug in Visual Studio template:

  3. 选择“使用此模板”按钮:Select Use this template button:

    此模板使用 Visual Studio Team Services (VSTS) 和推送通知服务。This template uses the Visual Studio Team Services (VSTS) and the Push notification services. 如果与其中任一服务没有连接,你将需要登录到这些服务。You'll need to sign into these services if you don't have a connection to either of them. 仅当需要登录到服务时,才会显示“登录”按钮。The Sign in button will appear only if you need to sign into a service.

  4. 登录到所有所需的服务后,选择“继续”按钮:After you sign into all required services, select the Continue button:

  5. (可选)通过在门户顶部的框中键入你选择的名称来更改流名称:(optional) Change the name of the flow by typing a name of your choice into the box at the top of the portal:

自定义用户输入Customize the user input

  1. 在触发器卡中,选择“编辑”:In the trigger card, select Edit:

  2. 选择 + 图标以展开页面,以便可以添加自定义输入字段:Select the + icon to expand the page so that you can add custom input fields:

  3. 为你希望在有人运行你的流时可用的每个自定义字段输入输入标题输入说明Enter the Input title and Input description for each custom field that you want to make available when someone runs your flow.

    在此示例中,你将创建两个自定义输入字段(Bug 重现步骤Bug 严重性),以便使用此流的任何人都可以输入用于重现该 Bug 并为该 Bug 的严重性评级的步骤:In this example, you'll create two custom input fields (Bug repro steps and Bug severity) so that anyone who uses this flow can enter the steps to reproduce the bug and rate the bug's severity:

自定义 BugCustomize the bug

  1. 点击“创建新的工作项”卡的标题栏:Tap the Create a new work item card's title bar:

  2. 做出适合于你的 VSTS 环境的选择,然后选择“编辑”:Make the selections that are appropriate for your VSTS environment, and then select Edit:

    例如,通过键入 myinstance 连接到 myinstance.visualstudio.com。For example, connect to myinstance.visualstudio.com by typing myinstance.

  3. 选择“显示高级选项”以显示此卡的其他字段:Select Show advanced options to reveal the other fields for this card:

  4. 将光标置于“Bug 标题”标记之前,然后将“严重性:”输入到“标题”文本字段。Place the cursor before the Bug title token, and then enter "Severity: " into the Title text field.

  5. 当光标仍位于标题文本字段中时,选择“Bug 严重性”标记,然后输入“ -- ”。With the cursor still in the title text field, select the Bug severity token, and then enter " -- ".

  6. 在“说明”文本字段中,将光标置于紧邻“Bug 说明”标记之后,然后按 Enter 以另起一个新行。In the Description text field, place your cursor just after the Bug description token, and then press Enter to start a new line.

  7. 将光标置于新行中,然后选择“Bug 重现步骤”标记:Place your cursor on the new line, and then select the Bug Repro steps token:

自定义推送通知Customize the push notification

  1. 点击“发送推送通知”卡上的标题栏以将其展开。Tap the title bar on the Send a push notification card to expand it.

  2. 在动态内容标记列表中,选择“查看更多”,然后在“链接”文本字段中添加“URL”标记。In the list of dynamic content tokens, select See more, and then add the URL token in the Link text field.

  3. 在“链接标签”文本字段中,添加“Id”标记:In the Link label text field, add the Id token:

  4. 点击菜单上的“创建流”以创建流:Tap Create flow on the menu to create your flow:

运行流Run your flow

在本演练中将使用 Microsoft Flow 的移动应用来运行你刚刚创建的按钮流。In this walk-through, you'll use the mobile app for Microsoft Flow to run the button flow you just created. 你将提供创建带有标题、说明、重现步骤和严重性级别的 Bug 所需的所有用户输入。You'll provide all the user input that's needed to create a bug with a title, a description, repro steps, and a severity level.

  1. 在 Microsoft Flow 的移动应用中,点击“按钮”选项卡,然后点击“创建带步骤的 Bug 报告”按钮。In the mobile app for Microsoft Flow, tap the Buttons tab, and then tap the Create bug report with steps button.

  2. 为要报告的 Bug 输入标题,然后点击“下一步”。Enter the title for the bug you are reporting, and then tap Next. 例如:For example:

  3. 输入要报告的 Bug 的说明,然后点击“下一步”。Enter the description of the bug you are reporting, and then tap Next. 例如:For example:

  4. 输入用于重新要报告的 Bug 的步骤,然后点击“下一步”。Enter the steps to reproduce the bug you are reporting, and then tap Next. 例如:For example:

  5. 输入要报告的 Bug 的严重性,然后点击“下一步”。Enter the severity of the bug you are reporting, and then tap Done:

    流将运行。The flow runs.

  6. (可选)点击“活动”选项卡以显示结果。(optional) Tap the Activity tab to show the results.

  7. (可选)通过点击“创建新的工作项”步骤来显示流运行的详细结果。(optional) Show the detailed results of the flow's run by tapping the Create a new work item step.

后续步骤Next steps