How to build Power Automate Approval Workflows for SharePoint | Step by Step Tutorial

4 min read 1 month ago
Published on Aug 03, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial provides a comprehensive guide to building approval workflows in Power Automate using SharePoint Lists. You'll learn how to create a secure approval process that prevents users from editing items under review, defines dynamic approvers, logs approval history, and allows for item resubmission after rejection.

Chapter 1: Setting Up SharePoint List for Power Automate Approvals

  1. Create a New List

    • Navigate to your SharePoint site.
    • Select the "Expense Tracker" list template.
  2. Add Columns

    • Status Column:
      • Type: Choice
      • Options: New, Under Review, Approved, Rejected
      • Default Value: New
    • Approval Info Column:
      • Type: Multi-line text
      • Enable "Append Changes to Existing Text"
      • Set "Enhanced Rich Text" to Yes
  3. Modify Form Settings

    • Remove the status column from the form to prevent user updates.
    • Save your changes.

Chapter 2: Building the Approval Workflow in Power Automate

  1. Create an Automated Cloud Flow

    • Go to Power Automate and select "Create."
    • Choose "Automated Cloud Flow."
    • Trigger: "When an item is created" in your SharePoint list.
  2. Configure the Flow

    • Connect to your SharePoint site and select your "Expense Tracker" list.
    • Update SharePoint Item:
      • Set the ID to the dynamic content ID from the trigger.
      • Change the status to "Under Review."
      • In "Approval Info," log who started the approval process.
  3. Start Approval Process

    • Add the "Start and wait for an approval" action.
    • Set the approval type to "Everyone must approve."
    • Fill in the details for title, description, and item link.

Chapter 3: Dynamically Assign Approvers

  1. Get Group Members

    • Use "Get group members" action to fetch email addresses of approvers from a security group (e.g., Expense Approvers).
    • Use the group ID for fetching members.
  2. Select Approvers Dynamically

    • Use the "Select" data operation to extract emails.
    • Switch to text mode for mapping and use the join() expression to create a semicolon-separated string of email addresses.

Chapter 4: Check Approval Outcome

  1. Add Condition to Check Approval Outcome
    • If the outcome does not contain "Reject," update the item status to "Approved."
    • In the "No" branch, update the status to "Rejected."

Chapter 5: Log Approval History

  1. Create HTML Table for Approval Info

    • Use the "Create HTML table" action to format the approval responses.
    • Add columns for:
      • Approver Name
      • Response Time (use the expression dateDiff())
      • Decision
  2. Style the HTML Table

    • Use a "Compose" action to apply styling to the HTML table.
  3. Update Approval Info Column

    • Assign the styled HTML table output to the "Approval Info" column in SharePoint.

Chapter 6: Implement Security Measures

  1. Adjust List Permissions

    • Stop inheriting permissions from the site.
    • Grant members only contribute access (view, add, update, delete).
  2. Set Item Security

    • Use "Stop sharing an item" action to restrict access.
    • Use "Grant access to an item" action for the item's creator and approvers.

Chapter 7: Restart Workflow on Item Modification

  1. Modify Trigger Action

    • Change the trigger to "When an item is created or modified."
    • Add trigger conditions to check if the status is "New" or "Rejected."
  2. Handle Infinite Loops

    • Set conditions to prevent the flow from triggering on every modification.
    • Allow modifications only when the item is rejected.
  3. Notify User on Rejection

    • Send notifications to the item creator upon rejection, inviting them to edit and resubmit.

Conclusion

You've now built a robust approval workflow in Power Automate, integrated with SharePoint. This setup not only secures items under review but also enhances user experience by allowing resubmissions. Next, consider exploring more complex workflows or integrating with other Microsoft services to further streamline your processes.