SOLVED

SharePoint Online list button: multiple visibility conditions

%3CLINGO-SUB%20id%3D%22lingo-sub-1239440%22%20slang%3D%22en-US%22%3ESharePoint%20Online%20list%20button%3A%20multiple%20visibility%20conditions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1239440%22%20slang%3D%22en-US%22%3E%3CP%3EHey%20All%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20toggle%20the%20visibility%20of%20a%20button%20in%20my%20SharePoint%20list%20with%20two%20columns%2C%20but%20I'm%20not%20sure%20if%20my%20conditions%20or%20syntax%20are%20correct.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20logic%20i'm%20trying%20to%20accomplish%20is%3A%20if%20%22column1%22%20%3D%3D%20%22Approved%22%20and%20%22column2%22%20!%3D%20%22Approved%22%20(meaning%20if%20it%20is%20equal%20to%20anything%20else%20BUT%20approved)%20then%20show%20the%20button%2C%20if%20not%2C%20hide%20the%20button%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20have%20a%20look%20at%20my%20JSON%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%7B%3CBR%20%2F%3E%22elmType%22%3A%20%22button%22%2C%3CBR%20%2F%3E%22txtContent%22%3A%20%22Reclaim%20Time%22%2C%3CBR%20%2F%3E%22customRowAction%22%3A%20%7B%3CBR%20%2F%3E%22action%22%3A%20%22executeFlow%22%2C%3CBR%20%2F%3E%22actionParams%22%3A%20%22%7B%5C%22id%5C%22%3A%20%5C%22Flow-ID%5C%22%7D%22%3CBR%20%2F%3E%7D%2C%3CBR%20%2F%3E%22style%22%3A%20%7B%3CBR%20%2F%3E%22background-color%22%3A%20%22%2302767a%22%2C%3CBR%20%2F%3E%22color%22%3A%20%22%23ffffff%22%2C%3CBR%20%2F%3E%22outline%22%3A%20%22transparent%22%2C%3CBR%20%2F%3E%22border-width%22%3A%20%221px%22%2C%3CBR%20%2F%3E%22border-style%22%3A%20%22solid%22%2C%3CBR%20%2F%3E%22border-color%22%3A%20%22transparent%22%2C%3CBR%20%2F%3E%22cursor%22%3A%20%22pointer%22%2C%3CBR%20%2F%3E%22font-size%22%3A%20%2212px%22%2C%3CBR%20%2F%3E%22visibility%22%3A%20%22%3Dif(%5B%24Status%5D%20%3D%3D%20'Approved'%2C%20'visible'%2C%20if(%5B%24Reclaimed_x0020_Time_x0020_Statu%5D%20!%3D%20'Approved'%2C%20'visible'%2C'hidden')%22%3CBR%20%2F%3E%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20note%20that%3A%3C%2FP%3E%3CP%3E1.%20I%20removed%20the%20Flow%20ID%2C%20otherwise%20the%20button%20is%20triggering%20the%20flow%20fine%3C%2FP%3E%3CP%3E2.%20%5B%24Reclaimed_x0020_Time_x0020_Statu%5D%20is%20the%20actual%20column%20name%20on%20SharePoint.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20let%20me%20know%20what%20i'm%20doing%20wrong%3F%20Any%20feedback%20is%20welcomed!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1243127%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20list%20button%3A%20multiple%20visibility%20conditions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1243127%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EMake%20sure%20you%20use%20'and'%20or%20'%26amp%3B%26amp%3B'%20for%20defining%20the%20two%20conditions%2C%20it%20should%20be%20one%20condition%20checking%20for%20two%20values.%20In%20your%20case%2C%20you%20have%20given%202%20conditions%20which%20shouldn't%20be.%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20it%20helps%2C%20please%20like%20it%20or%20mark%20it%20as%20a%20solution%20if%20it%20resolves%20ur%20clarification%20or%20issue%3CBR%20%2F%3E-Sudharsan%20K...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1243668%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20list%20button%3A%20multiple%20visibility%20conditions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1243668%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F421542%22%20target%3D%22_blank%22%3E%40Yarrah%3C%2FA%3E%26nbsp%3B%20as%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144422%22%20target%3D%22_blank%22%3E%40Sudharsan%20K%3C%2FA%3E%26nbsp%3Bsaid%2C%20the%20%26amp%3B%26amp%3B%20is%20what%20you%20need.%20The%20following%20will%20work%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%22visibility%22%3A%20%22%3Dif((%5B%24%3CSPAN%3Ecolumn1%3C%2FSPAN%3E%5D%20%3D%3D%20'Approved')%20%26amp%3B%26amp%3B%20(%5B%24column2%5D%20!%3D%20'Approved')%2C'visible'%2C'hidden')%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERob%3CBR%20%2F%3ELos%20Gallardos%3CBR%20%2F%3E%3CFONT%20size%3D%222%22%20color%3D%22%233366FF%22%3EMicrosoft%20Power%20Automate%20Community%20Super%20User%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1246364%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20list%20button%3A%20multiple%20visibility%20conditions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1246364%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F144422%22%20target%3D%22_blank%22%3E%40Sudharsan%20K%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20response.%20I%20eventually%20figured%20it%20out%20and%20even%20threw%20in%20and%20extra%20condition%20with%20an%20'%7C%20%7C'%20and%20it%20worked!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20for%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1246370%22%20slang%3D%22en-US%22%3ERe%3A%20SharePoint%20Online%20list%20button%3A%20multiple%20visibility%20conditions%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1246370%22%20slang%3D%22en-US%22%3E%3CP%3EHey%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F174092%22%20target%3D%22_blank%22%3E%40Rob%20Elliott%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20worked%20for%20me.%20Thank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

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! 

4 Replies
Highlighted
Hi,
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...
Highlighted
Best Response confirmed by Yarrah (Contributor)
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

Highlighted

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!

Highlighted

Hey @Rob Elliott 

 

This worked for me. Thank you!