Flow button IF Condition

New Contributor

Hy Guys,

I have my Sharepoint List with a button to execute a flow (Fechar Pedido, column 'Tete').

But I Want a condition,

IF the value of column 'Tipo de Ficha' = 'Novo Fornecedor',

 (The present flow button)

Else,

(Other Button with another flow on it)

 

CODE:

(This is the code for the present button)

 

 

{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "button",
    "customRowAction": {
      "action": "executeFlow",
      "actionParams": "{\"id\": \"dd3debb9-ee20-4051-823f-c0f7252dfb44\"}"
    },
    "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": "Fechar Pedido"
      }
    ]
  }

 

 

 

SHAREPOINT LIST:

12222.PNG

 

 

I Just wnat an IF Statement on that code. 

Thanks in advance

1 Reply

@jsantos489 

You could create multiple buttons instead and set those visibility individually.
Please have a close look at the column you refer to - those should be the internal names, not the display names.
e.g.:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "span",
  "style": {
    "color": "#0078d7",
    "display": "grid",
    "width": "180px"
  },
  "children": [
    {
      "elmType": "button",
      "style": {
        "border": "none",
        "background-color": "transparent",
        "color": "#0078d7",
        "cursor": "pointer",
        "display": "=if([$TipodeFicha] == 'Novo Fornecedor', 'block', 'none')"
      },
      "txtContent": "Fechar Pedido",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "{\"id\": \"dd3debb9-ee20-4051-823f-c0f7252dfb44\"}"
      }
    },
    {
      "elmType": "button",
      "style": {
        "border": "none",
        "background-color": "transparent",
        "color": "#0078d7",
        "cursor": "pointer",
        "display": "=if([$TipodeFicha] != 'Novo Fornecedor', 'block', 'none')"
      },
      "txtContent": "processo de solicitação",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "{\"id\": \"0X000000-123A-444-E11E-ABCDEFGHIJ\"}"
      }
    }
  ]
}

 
result:

Micca0815_0-1651073544815.png


Hope this helps, you can find further details and examples here:
https://pnp.github.io/List-Formatting/groupings/columntype/