使用 Microsoft Flow 创建并行审批工作流Create parallel approval workflows with Microsoft Flow

在并行审批工作流中,需要多名人员批准发票、采购订单、休假请求等项目。每个人员的审批与所有其他审批者无关。In a parallel approval workflow, multiple persons are required to approve items such as invoices, purchase orders, vacation requests, etc. Each person's approval is independent of all other approvers.

在本演练中,我们将使用 Microsoft Flow 来创建自动执行并行审批工作流的流。In this walkthrough, we use Microsoft Flow to create a flow that automates a parallel approval workflow. 此流自动执行员工休假请求过程,该过程需要获得该员工经常支持的所有人员(或组)的批准。This flow automates an employee vacation request process that requires approval from all persons (or teams) that the employee supports regularly. 员工使用 SharePoint 列表来请求休假。Employees use a SharePoint list to request vacation. 需要该员工的直属经理、销售团队和人力资源团队批准休假。Vacation approvals are required from the employee's direct manager, the Sales team, and the Human Resources team. 每个休假请求都会路由给每个审批者以做出决策。Each vacation request is routed to each approver for a decision. 该流发送状态发生更改的电子邮件,然后根据这些决策更新 SharePoint。The flow sends email with status changes and then updates SharePoint with the decisions.

先决条件Prerequisites

  • Microsoft FlowMicrosoft Flow.
  • SharePoint Online 列表。A SharePoint Online list.
  • Office 365 Outlook 和 Office 365 用户帐户。Office 365 Outlook and Office 365 Users account.

备注

虽然我们在本演练中使用 SharePoint Online 和 Office 365 Outlook,但你可以使用 Zendesk、Salesforce 或 Gmail 等其他服务。While we use SharePoint Online and Office 365 Outlook in this walk-through, you can use other services such as Zendesk, Salesforce, or Gmail.

创建流之前,请创建 SharePoint Online 列表;稍后,我们将使用此列表来请求批准休假。Before you create the flow, create a SharePoint Online list; later, we'll use this list to request approval for vacations.

所创建的 SharePoint Online 列表必须包含以下列:The SharePoint Online list you create must include the following columns:

SharePoint 列表列

请记下 SharePoint Online 列表的名称和 URL。Make note of the name and URL of the SharePoint Online list. 稍后我们将使用这些项来配置“SharePoint - 当创建项时”触发器。We use these items later to configure the SharePoint - When an item is created trigger.

从空白模板创建流Create your flow from the blank template

  1. 登录到 Microsoft FlowSign in to Microsoft Flow.

    登录

  2. 选择“我的流”选项卡。Select the My flows tab.

    选择我的流

  3. 选择“从零开始创建”。Select Create from blank.

    从空白创建

  4. 选择“从零开始创建”按钮。Select the Create from blank button.

添加触发器Add a trigger

  1. 将“Sharepoint”输入到搜索框中。Enter SharePoint into the search box.

    搜索 Sharepoint 触发器

  2. 查找并选择“SharePoint - 当创建项时”触发器。Find, and then select the SharePoint - When an item is created trigger.

    选择 Sharepoint 触发器

  3. 为 SharePoint 列表(你的流监视该列表的新项)选择站点地址列表名称Select the Site Address and the List Name for the SharePoint list that your flow monitors for new items.

Sharepoint 信息

获取创建休假请求的人员的管理器。Get the manager for the person who created the vacation request

  1. 选择“新建步骤”,然后选择“添加操作”。Select New step, and then select Add an action.

    新建步骤

  2. 将“获取管理器”输入到“选择操作”搜索框。Enter get manager into the Choose an action search box.

  3. 查找并选择“Office 365 用户 - 获取管理器 (V2)”操作。Find, and then select the Office 365 Users - Get manager (V2) action.

    选择 Office 用户

  4. 将“通过电子邮件创建”令牌插入到“获取管理器”卡上的“用户 (UPN)”框中。Insert the Created By Email token into the User (UPN) box on the Get manager card.

    此操作将获取在 SharePoint 中创建休假请求的人员的管理器。This action gets the manager for the person who created the vacation request in SharePoint.

    获取管理器配置

命名并保存流Name and save your flow

  1. 为流提供一个名称,然后选择“保存”图标来保存目前为止已进行的工作。Provide a name for your flow, and then select the Save icon to save the work we've done so far.

    保存流

备注

定期选择“保存”图标将所作更改保存到流中。Select the Save icon periodically to save the changes to your flow.

添加直属经理审批操作Add an approval action for immediate manager

  1. 选择“新建步骤”,然后选择“添加操作”。Select New step, and then select Add an action.

    新建步骤

  2. 将“审批”输入到“选择操作”搜索框。Enter approval into the Choose an action search box.

    搜索审批

  3. 选择“审批 - 启动审批”操作。Select the Approvals - Start an approval action.

    选择“审批”操作

  4. 配置“启动审批”卡以适合你的需求。Configure the Start an approval card to suit your needs.

    备注

    “标题”和“分配到”是必填字段。The Title and Assigned To fields are required. 可以使用 Markdown 设置“详细信息”字段的格式。You can use Markdown to format the Details field.

    配置审批

重要

此操作将休假请求发送至“分配到”框中的电子邮件地址,进而插入“联系经理(v2)”列表中的“电子邮件”令牌。This action sends the vacation request to the email address in the Assigned To box, so insert the Email token from the Get manager (v2) list.

插入销售团队并行分支审批操作Insert a parallel branch approval action for the sales team

  1. 选择位于“联系经理(v2)”和“开始审批”卡之间的向下箭头。Select the down arrow that's located between the Get manager (v2) and the Start an approval cards.

  2. 选择选中向下箭头后出现的加号。Select the plus sign that shows up on the down arrow after you select it.

  3. 选择“添加并行分支”。Select Add a parallel branch.

  4. 选择“添加操作”。Select Add an action.

    获取管理器配置

  5. 搜索、选择然后配置“启动审批”操作,将休假请求发送到销售团队。Search for, select, and then configure a Start an approval action that sends the vacation request to the sales team. 如果不确定如何添加“启动审批”操作,请参阅用于添加直属经理审批操作的步骤See the steps used to Add an approval action for immediate manager if you're not sure how to add the Start an approval action.

重要

使用“开始审批 2”操作的“分配到”框中的销售团队电子邮件地址。Use the sales team's email address in the Assigned To box of the Start an approval 2 action.

插入人力资源团队并行分支审批操作Insert a parallel branch approval action for the human resources team

  1. 重复插入销售团队并行分支步骤以添加并配置“启动审批”操作,来向人力资源发送休假请求。Repeat the steps to insert a parallel branch for the sales team to add, and then configure a Start an approval action to send vacation requests to human resources.

重要

使用“开始审批 3”操作的“分配到”框中的人力资源团队电子邮件地址。Use the human resources team's email address in the Assigned To box of the Start an approval 3 action.

如果已按照上述步骤执行操作,流应类似于以下示例:If you've followed along, your flow should resemble this example:

具有并行分支的流

添加并行分支后的选项Options after adding parallel branches

将操作添加到并行分支后,可以通过两个选项将更多步骤添加到流:After you've added actions to parallel branches, you have two options for adding more steps to your flow:

  1. 使用“插入新步骤”小按钮(当选择分支或分支正下方的区域上的任意空白区域时出现的圆形加号按钮)。Use the small Insert a new step button (the circular plus button that appears when you select any white space on a branch or the area immediately below a branch). 此按钮将步骤添加到该特定分支。This button adds a step to that specific branch. 在此特定分支完成后,将运行使用此按钮添加的步骤。Steps you add with this button run after this specific branch completes.
  2. 使用位于整个工作流底部的“新建步骤”大按钮。Use the larger New step button at the bottom of the entire workflow. 在所有分支完成后,将运行使用此按钮添加的步骤。Steps you add with this button run after all branches complete.

在以下部分中,我们将使用“插入新步骤”小按钮在每个分支上执行这些步骤:In the following sections, we use the small Insert a new step button to perform these steps on each branch:

  • 添加一个条件,检查休假请求是被批准还是被拒绝。Add a condition that checks if the vacation request was approved or rejected.
  • 发送电子邮件,告知员工相关决策。Send an email that informs the employee of the decision.
  • 使用该审批决策更新 SharePoint 中的休假请求。Update the vacation request in SharePoint with the approval decision.

然后,我们使用“新建步骤”大按钮发送电子邮件,其中概述了针对休假请求所做的所有决策。Then, we use the larger New step button to send an email that summarizes all decisions made on the vacation request.

继续以下操作:Let's continue:

向每个分支添加条件Add a condition to each branch

  1. 在“启动审批”分支上选择任意空白区域。Select any white space on the Start an approval branch.

  2. 选择“插入新步骤”小按钮(选择上一步骤中的空白区域后出现的圆形加号按钮)。Select the small Insert a new step button (the circular plus button that appears after you select the white space in the previous step).

  3. 从显示的菜单中选择“添加条件”。Select Add a condition from the menu that appears.

  4. 选择“条件”卡上的第一个框,然后从动态内容列表的“启动审批”类别中选择“响应”令牌。Select the first box on the Condition card, and then select the Response token from the Start an approval category in the dynamic content list.

    具有并行分支条件的流

  5. 确认列表(“条件”卡中间)已设置为“等于”。Confirm the list (in the middle of the Condition card) is set to is equal to.

  6. 在最后一个框中输入“批准”(此文本区分大小写)。Enter Approve (this text is case-sensitive) into the last box.

  7. “条件”卡现在应类似于以下示例:Your condition card should now resemble this example:

    具有并行分支条件的流

    备注

    此条件从“启动审批”操作检查传递给员工经理的响应。This condition checks the response from the Start an approval action that goes to the employee's manager.

  8. 在“启动审批 2”(对销售团队的审批请求)和“启动审批 3”(对人力资源的审批请求)分支上重复上述步骤。Repeat the preceding steps on the Start an approval 2 (the approval request to sales) and Start an approval 3 (the approval request to human resources) branches.

向每个分支添加电子邮件操作Add email actions to each branch

在“条件”分支的“如果是”侧执行下列步骤。Perform the following steps on the IF YES side of the Condition branch.

注意:请求得到批准时,流将使用这些步骤发送电子邮件:Note: Your flow uses these steps to send an email when the request is approved:

  1. 选择该条件的“如果是”分支上的“添加操作”。Select Add an action on the IF YES branch of the condition.

    添加新步骤

  2. 将“发送电子邮件”输入到“选择操作”卡上的搜索框中。Enter send email into the search box on the Choose an action card.

    搜索电子邮件操作

  3. 选择“Office 365 Outlook - 发送电子邮件”操作。Select the Office 365 Outlook - Send an email action.

    选择“发送电子邮件”操作

  4. 配置“电子邮件”卡以适合你的需求。Configure the email card to suit your needs.

    备注

    “收件人”、“主题”和“正文”是必填字段。To, Subject, and Body are required.

    此卡是休假请求状态更改时发送的电子邮件的模板。This card is a template for the email that is sent when the status of the vacation request changes.

    注意:在“发送电子邮件”卡上的“正文”框中,请使用来自“审批 - 启动审批”操作的“注释”标记。Note: In the Body box on the Send an email card, use the Comments token from the Approvals - Start an approval action.

配置预先批准的电子邮件模板

若要在请求被拒时发送电子邮件,请使用“条件”分支的“如果否”侧,然后重复上述步骤以添加拒绝电子邮件模板。To send an email when a request is rejected, use the IF NO side of the Condition branch, and then repeat the preceding steps to add a template for the rejection email.

在“启动审批 2”(对销售团队的审批请求)和“启动审批 3”(对人力资源的审批请求)分支上重复上述步骤。Repeat the preceding steps on the Start an approval 2 (the approval request to sales) and Start an approval 3 (the approval request to human resources) branches.

根据决策更新休假请求Update the vacation request with the decision

做出决策后,执行以下步骤更新 SharePoint。Perform the following steps to update SharePoint when decisions are made.

注意:请确保同时在分支的“如果是”和“如果否”两侧执行这些步骤。Note: Be sure perform these steps on both the IF YES and the IF NO sides of the branch.

  1. 在“如果是”分支中,选择“添加操作”。Select Add an action from the IF YES branch.

  2. 将“更新”输入到“选择操作”卡上的搜索框中。Enter update into the search box on the Choose an action card.

    搜索“更新”操作

  3. 选择“SharePoint - 更新项目”操作。Select the SharePoint - Update item action.

    选择更新项目

  4. 配置“更新项目”卡以适合你的需求。Configure the Update item card to suit your needs.

更新项目配置

在“启动审批 2”和“启动审批 3”分支上重复上述步骤。Repeat the preceding steps on the Start an approval 2 and Start an approval 3 branches.

完成流Complete the flow

  1. 选择“新建步骤” > “添加操作”Select New step > Add an action

    更新项目配置

  2. 使用先前提供的步骤发送汇总每个审批结果的电子邮件。Use the steps provided previously to send an email that summarizes the results of each approval. 将此电子邮件发送给请求休假的员工。Send this email to the employee who requested vacation. 卡可能类似于以下示例:Your card may resemble this example:

    更新项目配置

了解有关现代审批的详细信息Learn more about modern approvals

现代审批简介Introduction to modern approvals