Forum Discussion

Justmeck's avatar
Justmeck
Copper Contributor
Jan 12, 2024
Solved

Can I validate a colume based on athother colum?

Hello,

i have a colume "FlowIsOn" that is a boolean and true if my power automate flow i turned on. I have antoher calculated field or rather a button that starts the flow. I have discovered that you can use colum validation to block a colum if it is not validated. My question now is: Can you validate a colum based on another. So i only want the ability to press my "StartFlow" Button(colum) if the colume "FlowIsOn" is set to false.

  • Justmeck you don't need validation, all you need to do is to set the visibility property in the column where you've got your JSON-formatted button. By not being visible it can't be clicked:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "button",
      "txtContent": "Change Created By to Page Contact",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "='{\"id\":\"d25934c9-5059-47b0-864c-151e1d50796c\", \"headerText\":\" ' + [$Title] + '\",\"runFlowButtonText\":\"Go\"}'"
      },
      "style": {
        "background-color": "#ff4437",
        "color": "white",
        "border-radius": "10px",
        "visibility": "=if([$FlowRun] == true,'hidden','visible')"
      }
    }

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP (and classic 1967 Morris Traveller driver)

3 Replies

  • Rob_Elliott's avatar
    Rob_Elliott
    Bronze Contributor

    Justmeck you don't need validation, all you need to do is to set the visibility property in the column where you've got your JSON-formatted button. By not being visible it can't be clicked:

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "button",
      "txtContent": "Change Created By to Page Contact",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "='{\"id\":\"d25934c9-5059-47b0-864c-151e1d50796c\", \"headerText\":\" ' + [$Title] + '\",\"runFlowButtonText\":\"Go\"}'"
      },
      "style": {
        "background-color": "#ff4437",
        "color": "white",
        "border-radius": "10px",
        "visibility": "=if([$FlowRun] == true,'hidden','visible')"
      }
    }

     

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP (and classic 1967 Morris Traveller driver)

    • Justmeck's avatar
      Justmeck
      Copper Contributor

      Rob_Elliott Thank you for the quick response and example really apreciate it. It worked but do you know if you can add the same button inside the diffrent items when you open a contact?

      • Rob_Elliott's avatar
        Rob_Elliott
        Bronze Contributor

        Justmeck no, executeFlow is not supported in a list form. You'd need to have a Power Apps customised form for that.

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User.
        Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

Resources