Site icon @WonderLaura – Laura Rogers

SharePoint One Click Start Approval

sharepoint one click start approval process

Learn how to trigger an approval process, or any field change, with a single button click.

The Magic Button: Kickstarting Your SharePoint Approvals with Power Automate

With SharePoint, I typically use it for more than just storing files. I love building structured ways to get those files approved. That’s why I love Power Automate, for automating business processes. But how do you start that automated magic? In this post, I’ll walk you through creating a “Start Approval” button, for a smooth and efficient approval process, or any flow for that matter.

Why a Button? User-Initiated Control

Imagine uploading a document to SharePoint, collaborating on it, and then it is ready for review and approval. Instead of manually emailing approvers or updating statuses in multiple places, a single button click initiates the entire automated approval process. This user-initiated control empowers document owners to kick off the workflow when they’re ready for the file to be reviewed and approved.

SharePoint List / Library Configuration

Before we dive into the button itself, create a document library with a few columns for tracking the approval progress:

Note that if your process is extremely simple and does not entail multiple levels of approval, and you just want the button click to set it as “Approved”, then you can keep it extremely simple and you may not even need a flow.

The Power of JSON: Creating a Dynamic Button “Start Approval”

The “Start Approval” button isn’t a standard SharePoint column. We’ll use the magic of JSON (JavaScript Object Notation) to create a custom button that appears only when needed. This gives us fine-grained control over the button’s visibility and behavior. Here’s the JSON code that makes it all happen:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "style": {
    "background-color": "#3E8E41",
    "color": "white",
    "border-radius": "50px",
    "padding": "10px 20px",
    "font-size": "14px",
    "font-weight": "bold",
    "cursor": "pointer",
    "width": "auto",
    "border": "2px solid #3E8E41",
    "min-width": "120px",
    "display": "=if([$ApprovalStatus] == 'New' ,'inline', 'none')"
  },
  "attributes": {
    "title": "Click to start the approval process"
  },
  "txtContent": "Start Approval",
  "customRowAction": {
    "action": "setValue",
    "actionInput": {
      "ApprovalStatus": "Approval 1"
    }
  }
}

Let’s break down this code snippet:

Implementing the JSON: Formatting the “Start Approval” Column

Now that we have our JSON code, let’s add it to our SharePoint list.

1. Go to your document library settings, find the “Start Approval” column, and select Column settings > Format this column.

2. Next, click Advanced mode.

3. Paste your JSON code (from above) into the provided text area and click Save.

Testing the Start Approval Button: Seeing the Magic in Action

With the JSON code in place, upload a new document to your library. Since the Approval Status choice column has been set to have a default status of New, and the button logic says to only display the button when the status is New, you should see the “Start Approval” button appear next to the file. Clicking this button should instantly change the “Approval Status” to “Approval 1.” This change is the key—it’s what you can use to trigger a Power Automate flow to begin the approval process.

Beyond the Basics: Advanced Button Logic

You can extend the button code to create even more dynamic behavior:

This “magic button,” powered by JSON and integrated seamlessly within SharePoint, is the perfect launchpad for your automated approval workflows. By dynamically controlling its visibility and linking it to a status change that triggers Power Automate, you’ve taken the first step towards streamlined and efficient document approvals. In the next post, Trigger conditions for optimizing flow execution, we’ll delve into the trigger condition within Power Automate, exploring how it listens for that document status change and sets the automated approval process in motion!

References

Microsoft’s Use column formatting to customize SharePoint

Exit mobile version