Column Formatting AND

Iron Contributor

Hi,

 

I am trying to show a button for a flow action based on a specific content type and the content approval set to pending.

 

I can show the button if I only have the one field in the if statement but when I try to combine to 2 steps it doesnt work. Any help would be appreciated.

 

JSON:

{
"elmType": "span",
"style": {
"color": "#0078d7"
},
"children": [
{
"elmType": "button",
"style": {
"background-color": "purple",
"color": "white",
"cursor": "pointer",
"visibility": "=if([$ContentTypeId] == '0x010100328330ABC4EBE147A62B17E6255724E7', if([$_ModerationStatus] == 'Pending',visible,'hidden','hidden'))"
     },
"txtContent": "Get Approved",
     "customRowAction": {
     "action": "executeFlow",
     "actionParams": "{\"id\": \"183bedd4-6f2b-4264-855c-9dc7617b4dbe\"}"
     }
}
]
}

 

2 Replies

@Dhiran Gajjar There is a small mistake in the if clause with single quotes missing for 'visible'. These things can be tricky to spot. Try below:


"visibility": "=if([$ContentTypeId] == '0x010100328330ABC4EBE147A62B17E6255724E7', if([$_ModerationStatus] == 'Pending','visible','hidden','hidden'))"

 

@unnie ayilliath - thanks for correcting my JSON but now it correctly works for the content type but the 2nd if doesn't seem to effective 

 

"visibility": "=if([$ContentTypeId] == '0x0101005C391C83C0D9804184EE67C2B5A82F84', if([$_ModerationStatus] == 'Pending','visible','hidden','hidden'))"