SharePoint Online Button to run Flow

%3CLINGO-SUB%20id%3D%22lingo-sub-2839422%22%20slang%3D%22en-US%22%3ESharePoint%20Online%20Button%20to%20run%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2839422%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20Power%20Automate%20flow%20and%20a%20SharePoint%20Online%20list%2C%20I%20created%20a%20button%20following%20this%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fsharepoint%2Fsharepoint-button-to-run-a-power-automate-flow%2Fm-p%2F2249294%22%20target%3D%22_self%22%3Ediscussion%3C%2FA%3E.%20The%20problem%20is%20my%20button%20is%20created%20but%20it's%20not%20running%20the%20workflow%2C%20I%20tried%20to%20debug%20the%20workflow%20but%20workflow%20is%20not%20running.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20workflow%20starts%20by%20selected%20an%20item%20in%20the%20SharePoint%20Library%2C%20then%20sending%20an%20email%2C%20and%20then%20looking%20for%20approval.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20the%20code%20of%20my%20button%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%22%24schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fv2%2Fcolumn-formatting.schema.json%22%2C%0A%20%20%20%20%22elmType%22%3A%20%22button%22%2C%0A%20%20%20%20%22customRowAction%22%3A%20%7B%0A%20%20%20%20%20%20%22action%22%3A%20%22executeFlow%22%2C%0A%20%20%20%20%20%20%22actionParams%22%3A%20%22%7B%5C%22id%5C%22%3A%20%5C%22Flow%20ID%5C%22%7D%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22attributes%22%3A%20%7B%0A%20%20%20%20%20%20%22class%22%3A%20%22ms-fontColor-themePrimary%20ms-fontColor-themeDarker--hover%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22style%22%3A%20%7B%0A%20%20%20%20%20%20%22border%22%3A%20%22none%22%2C%0A%20%20%20%20%20%20%22background-color%22%3A%20%22transparent%22%2C%0A%20%20%20%20%20%20%22cursor%22%3A%20%22pointer%22%0A%20%20%20%20%7D%2C%0A%20%20%20%20%22children%22%3A%20%5B%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22elmType%22%3A%20%22span%22%2C%0A%20%20%20%20%20%20%20%20%22attributes%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22iconName%22%3A%20%22Flow%22%0A%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%22style%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22padding-right%22%3A%20%221px%22%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22elmType%22%3A%20%22span%22%2C%0A%20%20%20%20%20%20%20%20%22txtContent%22%3A%20%22Submit%22%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%5D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThanks%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2839422%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2841312%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20Button%20to%20run%20Flow%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2841312%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1183558%22%20target%3D%22_blank%22%3E%40CR-88%3C%2FA%3E%26nbsp%3Byour%20JSON%20code%20needsto%20look%20like%20this%2C%20changing%20the%20txtContent%20to%20the%20text%20you%20want%20on%20the%20button%2C%20and%20the%20id%20needs%20to%20be%20your%20flow's%20ID%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%22%24schema%22%3A%20%22https%3A%2F%2Fdeveloper.microsoft.com%2Fjson-schemas%2Fsp%2Fv2%2Fcolumn-formatting.schema.json%22%2C%0A%20%20%22elmType%22%3A%20%22button%22%2C%0A%20%20%22txtContent%22%3A%20%22Press%20this%20button%22%2C%0A%20%20%22customRowAction%22%3A%20%7B%0A%20%20%20%20%22action%22%3A%20%22executeFlow%22%2C%0A%20%20%20%20%22actionParams%22%3A%20%22%7B%5C%22id%5C%22%3A%20%5C%2270bcc1be-c1af-436c-94a6-50828b1582ef%5C%22%7D%22%0A%20%20%7D%2C%0A%20%20%22style%22%3A%20%7B%0A%20%20%20%20%22background-color%22%3A%20%22%23460302%22%2C%0A%20%20%20%20%22color%22%3A%20%22%23ffffff%22%0A%20%20%7D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20this%20is%20to%20work%20with%20a%20document%20library%2C%20your%20trigger%20in%20the%20flow%20must%20be%20the%20SharePoint%20%22for%20a%20selected%20file%22.%20If%20it%20was%20a%20list%20it%20woujld%20be%20%22for%20a%20selected%20list%22%3C%2FP%3E%3CP%3E%3CBR%20%2F%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%20color%3D%22%23006400%22%3EIntranet%2C%20SharePoint%20and%20Power%20Platform%20Manager%20(and%20classic%201967%20Morris%20Traveller%20driver)%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

I have a Power Automate flow and a SharePoint Online list, I created a button following this discussion. The problem is my button is created but it's not running the workflow, I tried to debug the workflow but workflow is not running.

 

My workflow starts by selected an item in the SharePoint Library, then sending an email, and then looking for approval.

 

This is the code of my button:

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "button",
    "customRowAction": {
      "action": "executeFlow",
      "actionParams": "{\"id\": \"Flow ID\"}"
    },
    "attributes": {
      "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
    },
    "style": {
      "border": "none",
      "background-color": "transparent",
      "cursor": "pointer"
    },
    "children": [
      {
        "elmType": "span",
        "attributes": {
          "iconName": "Flow"
        },
        "style": {
          "padding-right": "1px"
        }
      },
      {
        "elmType": "span",
        "txtContent": "Submit"
      }
    ]
}
 
Thanks
1 Reply

@CR-88 your JSON code needsto look like this, changing the txtContent to the text you want on the button, and the id needs to be your flow's ID:

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Press this button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"70bcc1be-c1af-436c-94a6-50828b1582ef\"}"
  },
  "style": {
    "background-color": "#460302",
    "color": "#ffffff"
  }
}

 

 

As this is to work with a document library, your trigger in the flow must be the SharePoint "for a selected file". If it was a list it woujld be "for a selected list"


Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)