Forum Discussion
SharePoint Online list button: multiple visibility conditions
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!
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
- Sudharsan KSteel ContributorHi,
Make sure you use 'and' or '&&' for defining the two conditions, it should be one condition checking for two values. In your case, you have given 2 conditions which shouldn't be.
Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue
-Sudharsan K...- YarrahBrass Contributor
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!
- RobElliottSilver Contributor
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- YarrahBrass Contributor