Forum Discussion

PhilFancyAndMe's avatar
PhilFancyAndMe
Iron Contributor
Aug 17, 2021
Solved

List Formatting - Conditional Button to start Flows

Hi,   I got this button to start a Flow out of a list right now. This works fine:   { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType"...
  • PhilFancyAndMe's avatar
    Aug 17, 2021

    After further digging on Microsoft Docs I got a solution for this. *facepalm*

    Hope this helps someone else as well. 

    If boolean column "Finished" is false:
    -> starts Power Automate Flow A and shows button text "Step 3"
    If boolean column "Finished" is true:
    -> starts Power Automate Flow B and shows button text "Step 4"

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "button",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": 
    		   {
              "operator": ":",
              "operands": [
                {
                  "operator": "==",
                  "operands": [
                    "[$Finished]",
                    true
                  ]
                },
                "{\"id\": \"e574c8fb-231b-bbbb-b96a-b8e5025b0410\"}",
                "{\"id\": \"aace4a99-3b30-aaaa-bbf6-c8c9dc134fda\"}"
              ]
          }
    	
      },
      "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": "6px"
          }
        },
        {
          "elmType": "span",
    	  "txtContent": 
    	   {
              "operator": ":",
              "operands": [
                {
                  "operator": "==",
                  "operands": [
                    "[$Finished]",
                    true
                  ]
                },
                "Step 4",
                "Step 3"
              ]
          }
        }
      ]
    }

     

     

Resources