Forum Discussion

Claudia_Polders's avatar
Claudia_Polders
Copper Contributor
Feb 21, 2020
Solved

Conditional formatting - Button flow inserted in SharePoint list - how to insert a logic condition

Hi,

 

I have added a column with  flow button, in my list, using JSON. I am really a beginner in JSON.

I need to add a condition like:

If Status=Pending or Status=Approved with comments, then show "Send to Approval" button.

 

The code is in the attachment.

Any help is highly appreciated.

Thank you!

  • RobElliott's avatar
    RobElliott
    Silver Contributor

    @Hi Claudia_Polders  the JSON you've provided won't actually trigger a flow as you need to tell it which flow to trigger in the actionparams line.

     

    But what you can do is to trigger an approval flow from the button via flow in Power Automate. Do you want me to post the changes to the JSON code and the steps in the flow to do that? If you do I'd recommend you add some columns to your list for the approver decision, approver name, approver date and approver comments. When the apporver has done their bit in the email this approval information can be saved back to your SharePoint list as an action in the flow.

     

    So let me know if you need the steps to achieve this.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

    • RobElliott's avatar
      RobElliott
      Silver Contributor

      FabioO365GoDsorry, slightly off-topic but thanks for the pointer on showing the button only if a  condition is met. I adjusted it slightly to cope with if another column has a value then hide the button, otherwise show it:

       

      {
         "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
         "elmType": "button",
         "txtContent": "Send for Approval",
         "customRowAction": {
            "action": "executeFlow",
            "actionParams": "{\"id\": \"355cfb96-ddc5-4911-956c-9705f7557ee5\"}"
         },
         "style": {
            "background-color": "#468259",
            "color": "white",
            "visibility": "=if(([$Control] == 'Published'),'hidden','visible')"
         }
      }

       

      Rob
      Los Gallardos
      Microsoft Power Automate Community Super User

Resources