Mar 19 2020 11:43 AM - edited Mar 19 2020 11:44 AM
Hey All,
I am trying to toggle the visibility of a button in my SharePoint list with two columns, but I'm not sure if my conditions or syntax are correct.
The logic i'm trying to accomplish is: if "column1" == "Approved" and "column2" != "Approved" (meaning if it is equal to anything else BUT approved) then show the button, if not, hide the button
Please have a look at my JSON:
{
"elmType": "button",
"txtContent": "Reclaim Time",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"Flow-ID\"}"
},
"style": {
"background-color": "#02767a",
"color": "#ffffff",
"outline": "transparent",
"border-width": "1px",
"border-style": "solid",
"border-color": "transparent",
"cursor": "pointer",
"font-size": "12px",
"visibility": "=if([$Status] == 'Approved', 'visible', if([$Reclaimed_x0020_Time_x0020_Statu] != 'Approved', 'visible','hidden')"
}
}
Please note that:
1. I removed the Flow ID, otherwise the button is triggering the flow fine
2. [$Reclaimed_x0020_Time_x0020_Statu] is the actual column name on SharePoint.
Can anyone let me know what i'm doing wrong? Any feedback is welcomed!
Mar 20 2020 07:48 PM
Mar 21 2020 04:04 AM
Solution@Yarrah as @Sudharsan K said, the && is what you need. The following will work:
"visibility": "=if(([$column1] == 'Approved') && ([$column2] != 'Approved'),'visible','hidden')"
Rob
Los Gallardos
Microsoft Power Automate Community Super User
Mar 23 2020 05:07 AM - edited Mar 23 2020 05:07 AM
Hey @Sudharsan K
Thank you for your response. I eventually figured it out and even threw in and extra condition with an '| |' and it worked!
Thank for your help!
Mar 23 2020 05:08 AM
Mar 21 2020 04:04 AM
Solution@Yarrah as @Sudharsan K said, the && is what you need. The following will work:
"visibility": "=if(([$column1] == 'Approved') && ([$column2] != 'Approved'),'visible','hidden')"
Rob
Los Gallardos
Microsoft Power Automate Community Super User