cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

SharePoint Online column json formatting on folders issue

Hello,

 

I have an SP list where the user is allowed to create folders and then add list item inside those folders. I have a flow attached to this list which gets triggered manually. I have added json formatting to show/hide the Manual trigger button based on the Content Approval status.

 

Issue:

The issue I am having is that the json formatting also shows up on the folders created in the list. How can I only show the json formatting on list items and skip if there is a folder

 

Here is the json I have written so far.

 

{
"elmType": "button",
"style": {
"border": "solid",
"background-color": "white",
"color": "#0078d7",
"cursor": "pointer",
"visibility": "=if(([$_ModerationStatus] == 'Pending'),'visible','hidden')"
},
"txtContent": "Click to begin review",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"flowID\"}"
}
}

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

I think I figured out the solution. I added a condition to see if the ContentType == 'Item' and that seems to have done the job. Now the formatting only shows up on list items and not on Folders.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

I think I figured out the solution. I added a condition to see if the ContentType == 'Item' and that seems to have done the job. Now the formatting only shows up on list items and not on Folders.

View solution in original post

PatUmaknow
Frequent Visitor

Hi,

The problem with this solution is that you have to show the ContentType column to the view in order to use it in your JSON code, which is not expected from your customer.

A similar approach is to use the ContentTypeId value (it's not a column and it's recognized in the JSON code) and compare it with the content-type id of what you want to show/hide.

For example, to hide a button for folder, use the following (in the Style section):

"visibility": "=if(((indexOf([$ContentTypeId],'0x0120')) == 0),'hidden', 'visible')"

Note: 0x0120 is the id of the folder content-type.

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (92,110)