Sunday, 20 September 2026

Add a button to a SharePoint list item to start a Power Automate workflow

 

Triggering a Power Automate workflow from a SharePoint list item is a common requirement.

It's easy enough to trigger a workflow when an item is modified using a trigger condition so it only fires when a specific field changes - we'll cover that below - but adding a button makes the process more user friendly and gives you the button text to tell the user what the button does. This is preferable to just a column header that may not make it clear to the user that changing the value will trigger a flow. 

We're going to create a button which will change the value of a Yes/No column, and that will trigger a workflow. In my use case I want the workflow to generate a document so that's what the column header and button refer to, but you can modify it for your needs.

  1. Create a Yes/No field called Run Flow.
  2. Create a single line text field called Generate. This will become the button.
  3. Click the arrow next to the Generate column header, go to Column settings > Format this column and set the JSON to:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", 
      "elmType": "button",
      "txtContent": "Generate document",
      "customRowAction": {
        "action": "setValue",
        "actionInput": {
          "RunFlow": 1
        }
      }
    }


    This JSON sets the element type to button, gives the button a label of "Generate document", and when the button is clicked it changes the Run Flow Yes/No column to Yes.

    To change the:
     - button text, modify the txtContent value from "Generate document"
     - column, modify the actionInput value from "RunFlow"

    Note that the column I created was called "Run Flow" but the actionInput is changing "RunFlow". That's because in line with best practise I removed the space when I created the column and added it back in afterwards so the column header is more human readable. The JSON needs the original column name (RunFlow) not the name that was modified after the column was created (Run Flow).

  4. Create a flow which triggers when an item is modified. Set the trigger condition to be:

    @equals(triggerOutputs()?['body/RunFlow'], true)

  5. This workflow will now only trigger when the RunFlow field is set to 1. When you click the Generate document button, RunFlow field is set to 1 so the workflow will run. 
That's all there is to it. 

If you don't want the workflow to run every time someone changes the item from now on, make sure your workflow changes the value of RunFlow back to 0.

For workflows that might take a little time to run, such as a document generation or approval flow, I like to add a "Flow Running" Yes/No column that is switched on by the workflow and then switched off once the work is compete. Combined with some colour formatting of the row for a nice visual cue, this provides an easy way for the user to see when the flow has finished.