Exercise - Build an approval request

Completed

In this unit, you learn how to build a business-friendly scenario that uses approvals.

In this scenario, anyone who has access to the SharePoint library can add a document. When the document is created, an approval starts that allows certain users to approve. If the document is approved, it stays in the document library. If the document is rejected, then it's moved to a separate folder.

Prerequisites

  • Access to Power Automate

  • A Microsoft Office 365 account with access to SharePoint

Note

You need to create the document library in your own SharePoint tenant.

Step 1: Create a document library

First, let's create a library.

  1. On your SharePoint site home page, select + New and then Document Library.

  2. Name your library Approvals Library and then select Create.

  3. In your new document library, at the top, choose + New and select Folder.

  4. Name your folder Rejected Documents and select Create.

Now, let's create our approval flow.

  1. Next go to the Power Automate maker portal.

  2. In the Copilot text area, type When a file is created (properties only), add a start and wait for approval action and add a condition depending on the approval outcome.

  3. Select Generate.

    Screenshot of the maker portal and the copilot prompt.

  4. Copilot generates a flow based on the prompt provided. You can continue to converse back and forth with Copilot to refine the flow for what you want. Once you're satisfied with the structure of the flow, select Next.

    Note

    Copilot may have added Scope actions down the true and false sides of the condition. This example flow won't use the Scope actions, but since Scope actions hold other actions, they were left in the flow. For more information about the Scope action, see: Group and run actions by scope - Azure Logic Apps | Microsoft Learn

  5. Review your connections. If you aren't already connected, select the 3 dots and select Add new connection. Once connected select Create flow.

  6. Select the When a file is created (properties only) trigger and choose your SharePoint site and Approvals Library on the left.

  7. Select the Start and wait for an approval action. The properties panel opens on the left hand side.

  8. Choose Approve/Reject - First to respond from the Approval Type dropdown.

  9. Using Copilot on the right hand side, type Update the title field to Document Approval.

  10. In the Assigned To field, enter your organization email address (this is for testing purposes. You can always come back and choose a different approver later if you wish).

  11. Put your cursor in the Item Link box and select the lightning bolt icon next to it. This pulls up your dynamic content for this section.

  12. Choose Link to item in the pop-up window.

    Screenshot of copilot properties.

  13. Select the Condition action to review what Copilot automatically selected as the condition. Ensure that the Outcome property from the Start and wait an approval action is on the left and Approve is on the right.

  14. Select the + icon under the False side of the condition and choose Add an action.

  15. Search for move and choose Move file action.

  16. Choose your SharePoint site address from the first dropdown.

  17. Select the File Identifier under File to Move, and choose the lightning bolt icon again.

  18. Search for identifier and select the Identifier field from the SharePoint action.

  19. Choose the same SharePoint site for the Destination Site Address.

  20. For the Destination Folder, select the folder icon on the right side. Find your Approvals Library and select the arrow to the right of its name. Then select the folder name Rejected Documents.

  21. Under If Another File Is Already There choose Move with a new name.

    Screenshot of If another file is already there option filled in with Move with a new name.

  22. Save your flow with the button in the top right corner.

To test your flow, go back to your SharePoint Approvals Library and add a new document.

After a short amount of time, an approval appears under the approvals section of the Power Automate maker portal.

Screenshot of Power Automate showing Approvals on the Received tab.

Select the approval and choose your response. If you choose Reject, refresh your SharePoint Approvals Library and the document is gone. Select the Rejected Document folder and you can see your file moved there.

Congrats! You built an approval flow using Copilot that allows users to approve or reject documents in a SharePoint document library.

You can easily edit or extend this approval flow to better fit your needs. Or check out the approvals Power Automate Templates to give yourself various starting places for your own approvals.