建立流程來管理專案核准Create a flow to manage project approvals

注意:這篇文章是搭配 SharePoint Online 使用 PowerApps、Microsoft Flow 及 Power BI 之教學課程系列的一部分。Note: This article is part of a tutorial series on using PowerApps, Microsoft Flow, and Power BI with SharePoint Online. 請確定您閱讀系列簡介以了解大致概念,以及相關下載項目。Make sure you read the series introduction to get a sense of the big picture, as well as related downloads.

在這項工作中,我們將建立流程,驅動核准專案的處理程序。In this task we'll create a flow that drives the process of approving projects. Microsoft Flow 與 SharePoint 整合,因此很容易就能直接從清單建立。Microsoft Flow is integrated with SharePoint, so it's easy to create a flow directly from a list. 我們建立的流程會在項目新增至 [專案要求] 清單時觸發。The flow we'll create is triggered when an item is added to the Project Requests list. 流程會傳送電子郵件給專案核准者,核准者直接在電子郵件核准或拒絕要求。The flow sends an email to the project approver, who approves or rejects the request directly in email. 然後流程會傳送核准或拒絕電子郵件給專案要求者,然後適當地更新我們的 SharePoint 清單。The flow then sends an approval or rejection email to the project requestor and updates our SharePoint lists appropriately.

步驟 1:設定流程範本Step 1: Configure the flow template

  1. 在 [專案要求] 清單中,按一下或點選 [流程],然後按一下或點選 [建立流程]。In the Project Requests list, click or tap Flow, then Create a flow.

    建立流程

  2. 在右窗格中,按一下或點選 [在新增新項目時開始核准]。In the right pane, click or tap Start approval when a new item is added.

    建立核准流程

  3. 如果您尚未登入,請登入 SharePoint 和 Outlook,然後按一下或點選 [繼續]。If you're not already signed in, sign into SharePoint and Outlook, then click or tap Continue.

    登入以使用範本

    現在您會看到這個流程的範本,已準備好讓您完成。You now see the template for this flow, ready for you to complete. 流程中的方塊代表步驟。The boxes in the flow represent steps. 它們接受來自先前步驟的輸入,以及您提供的輸入。They take input from previous steps, as well as input that you provide. 然後每個步驟可以提供後續步驟的輸出。Each step can then provide output to subsequent steps.

    核准範本

  4. 在 [指派給] 方塊中,輸入您租用戶中的有效名稱。In the Assigned To box, enter a name that is valid in your tenant.

    核准電子郵件連絡人

    流程中的下一個方塊會回應專案核准者的決策,並將流程路由至兩個「分支」之一:[若為是] 或 [若為否]。The next box in the flow responds to the project approver's decision and routes the flow to one of two branches: If yes or If no.

    核准條件

步驟 2:建立「核准 = 是」的動作Step 2: Create actions for Approve = yes

根據預設,此分支會將核准電子郵件傳送給要求者。By default, this branch sends an approval email to the requestor. 我們也會更新 [專案要求]清單,並將項目新增至 [專案詳細資料] 清單,因為專案已獲得核准。We'll also update the Project Requests list, and add an item to the Project Details list because the project has been approved.

  1. 在 [若為是] 分支中,按一下或點選 [通知項目建立者獲得核准],然後 [編輯] 以查看傳送給要求者之電子郵件的預設選項。In the If yes branch, click or tap Inform item creator of approval, then Edit to see the default options for the email sent to the requestor.

    編輯電子郵件設定

  2. 根據預設,電子郵件會傳送給建立清單項目的人員,具有您看到的主旨列和訊息本文。By default, an email is sent to the person who created the list item, with the subject line and message body that you see. 您可以視需要更新。You can update these if you like.

    預設電子郵件設定

  3. 按一下或點選 [新增動作]。Click or tap Add an Action.

    新增動作

  4. 在 [選擇動作] 底下,搜尋 "SharePoint",然後按一下或點選 [SharePoint – 更新項目]。Under Choose an action, search for "SharePoint", then click or tap SharePoint – Update item.

    更新項目動作

  5. 輸入 SharePoint 網站 URL 和清單名稱。Enter the SharePoint site URL and list name.

    更新項目參數

  6. 選取 [識別碼] 方塊,然後在動態內容對話方塊中按一下或點選 [識別碼]。Select the Id box, then click or tap ID in the dynamic content dialog box.

    清單識別碼動態內容

    根據先前的步驟,動態內容可以在整個流程中使用。Dynamic content is available throughout the flow, based on previous steps. 在此情況下,SharePoint 清單資訊可以使用,且我們可以在我們建立的動作中使用它。In this case, the SharePoint list information is available, and we can use it in the actions that we create.

  7. 選取 [標題] 方塊,在動態內容對話方塊中搜尋「標題」,然後按一下或點選 [標題]。Select the Title box, search for "Title" in the dynamic content dialog box, then click or tap Title.

    清單標題動態內容

  8. 在 [已核准] 方塊中,輸入「是」。In the Approved box, enter "Yes". 流程的這個部分現在看起來應該像下列映像。This part of the flow should now look like the following image.

    清單更新

  9. 再次按一下或點選 [新增動作]。Click or tap Add an Action again. 這次我們會將項目新增至專案已核准的 [專案詳細資料] 清單。This time we'll add an item to the Project Details list for the project that was approved.

    新增動作

  10. 在 [選擇動作] 底下,搜尋 "SharePoint",然後選取 [SharePoint – 建立項目]。Under Choose an action, search for "SharePoint", then select SharePoint – Create item.

    建立項目動作

  11. 輸入 SharePoint 網站 URL 和清單名稱。Enter the SharePoint site URL and list name.

    建立項目參數

  12. 選取 [標題] 方塊,在動態內容對話方塊中搜尋「標題」,然後按一下或點選 [標題]。Select the Title box, search for "Title" in the dynamic content dialog box, then click or tap Title.

    清單標題動態內容

  13. 選取 [RequestId] 方塊,然後按一下或點選動態內容對話方塊中的 [識別碼]。Select the RequestId box, then click or tap ID in the dynamic content dialog box.

    清單識別碼動態內容

  14. 在 [PMAssigned] 方塊中,輸入「未指派」。In the PMAssigned box, enter "Unassigned". 流程的這個部分現在看起來應該像下列映像。This part of the flow should now look like the following image.

    建立項目完成

步驟 3:檢閱「核准 = 否」的動作Step 3: Review action for Approve = no

根據預設,此分支會將拒絕電子郵件傳送給要求者。By default, this branch sends a rejection email to the requestor. 我們也會更新 [專案要求] 清單。We'll also update the Project Requests list. 專案沒有進度,我們不會將項目新增至 [專案詳細資料] 清單。The project isn't moving forward, so we don't add an item to the Project Details list.

  1. 在 [若為否] 分支中,按一下或點選 [通知項目建立者遭到拒絕],然後 [編輯] 以查看傳送給要求者之電子郵件的預設選項。In the If no branch, click or tap Inform item creator of rejection, then Edit to see the default options for the email sent to the requestor.

    編輯電子郵件設定

  2. 根據預設,電子郵件會傳送給建立清單項目的人員,具有您看到的主旨列和訊息本文。By default, an email is sent to the person who created the list item, with the subject line and message body that you see. 您可以視需要更新。You can update these if you like.

    預設電子郵件設定

  3. 按一下或點選 [新增動作]。Click or tap Add an Action.

    新增動作

  4. 在 [選擇動作] 底下,搜尋 "SharePoint",然後按一下或點選 [SharePoint – 更新項目]。Under Choose an action, search for "SharePoint", then click or tap SharePoint – Update item.

    更新項目動作

  5. 輸入 SharePoint 網站 URL 和清單名稱。Enter the SharePoint site URL and list name.

    更新項目參數

  6. 選取 [識別碼] 方塊,然後在動態內容對話方塊中按一下或點選 [識別碼]。Select the Id box, then click or tap ID in the dynamic content dialog box.

    清單識別碼動態內容

  7. 選取 [標題] 方塊,在動態內容對話方塊中搜尋「標題」,然後按一下或點選 [標題]。Select the Title box, search for "Title" in the dynamic content dialog box, then click or tap Title.

    清單標題動態內容

  8. 在 [已核准] 方塊中,輸入「否」。In the Approved box, enter "No". 流程的這個部分現在看起來應該像下列映像。This part of the flow should now look like the following image.

    清單更新

  9. 在畫面右上角,按一下或點選 [建立流程],然後按一下或點選 [完成]。At the top right of the screen, click or tap Create flow, then Done.

    完成按鈕

    流程現在已完成,如果您摺疊方塊,看起來應該像下列映像。The flow is now complete, and it should look like the following image if you collapse the boxes.

    完成的流程

步驟 4:執行核准流程Step 4: Run the approval flow

  1. 在 [專案要求] 清單中,按一下 [快速編輯] 並且新增項目,如下所示:In the Project Requests list, click Quick Edit and add an item like the following:

    • Title = "New monitor for Megan"Title = "New monitor for Megan"
    • Approved = "Pending"Approved = "Pending"
    • Description = "Megan needs a 24" monitor"Description = "Megan needs a 24" monitor"
    • EstimatedDays = "1"EstimatedDays = "1"
    • ProjectType = "New hardware"ProjectType = "New hardware"
    • RequestDate = "02/03/2017"RequestDate = "02/03/2017"
    • Requestor = "Megan Bowen"Requestor = "Megan Bowen"

      新增至清單的項目

  2. 當您完成時,按一下頁面頂端的 [完成]。Click Done at the top of the page when you're finished.

    完成核取記號

  3. 請檢查核准者電子郵件帳戶的收件匣。Check the inbox of the approver's email account. 您應該會收到如下所示的電子郵件。You should have an email like the following.

    給 Allan Deyoung 的電子郵件

  4. 在您按一下 [核准] 或 [拒絕] 之後,流程會執行另一個處理程序,您會直接在電子郵件中取得如下所示的意見反應。After you click Approve or Reject, the flow runs another process, and you get feedback like the following, directly in the email.

    核准動作完成

  5. 流程會傳送電子郵件給 Megan,附上 Allan 的回應,如下列映像所示。The flow sends an email to Megan with Allan's response, as in the following image. 這封電子郵件來自 Megan,因為她擁有流程。This email comes from Megan because she owns the flow.

    給 Megan Bowen 的電子郵件

後續步驟Next steps

此教學課程系列的下一個步驟是建立應用程式來管理專案The next step in this tutorial series is to create an app to manage projects.