Forum Discussion
Jin Chen
Nov 02, 2020Iron Contributor
Comment in Microsoft List
Hello MSFT
Today, I found that I am now able add comment in Microsoft list for one of my list. However, I am finding some issues:
1. After a comment is added, I dont see any icon on the quick vie...
ganeshsanap
Dec 10, 2020MVP
Try using below JSON code. It will bold the title text and show comments icon if there are any comments added.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontSize-m"
},
"children": [
{
"elmType": "span",
"txtContent": "@currentField",
"style": {
"font-weight": "bold"
}
},
{
"elmType": "span",
"style": {
"font-size": "16px",
"margin-left": "10px",
"display": "=if([$_CommentCount] == '0' , 'none' , 'block')"
},
"attributes": {
"iconName": "Comment"
}
}
]
}
Microsoft documentation: Use column formatting to customize SharePoint
Additional References:
- SharePoint Online: All you need to know about Commenting in Lists
- How to Enable/Disable the commenting in SharePoint Online/Microsoft Lists
Please click Mark as Best Response if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
AndrejSramko
Jul 21, 2023Copper Contributor
ganeshsanap I have just noticed a small error in the condition that prevents the icon from being hidden. $_CommentCount should be compared to empty string ('')
"=if([$_CommentCount] == '' , 'none' , 'block')"