Format list view => icon if attachment

Occasional Contributor



I have formatted a sharepoint list with JSON. Now I want to show up an icon if there is an attachment attached to the item. I have tried this:


"children": [
   "elmType": "span",
    "style": {},
    "attributes": {
    "iconName": "=if([$Attachments] == '1', 'Attach', 'FieldEmpty')",
If I fill in this code into my whole JSON Code, then all my items dissapear and the list is empty.
What am I doing wrong?
Can someone help me please?
Greetings from Germany.
3 Replies
If you just want to show an icon, why dont you use the inbuilt attachment column which does the same. Is there any other feature you are trying to built based on the icon?

@Sudharsan K 



my problem is that I dont know how I can read out the attachments column. If I use


"txtContent": "[$Attachments]"


nothing happens. Is that the right internal name for the Attachment list? And I want to show how many Attachments are behind a list item. 

Hi @chhe5,


I have the same problem with the Attachments field. Have you already found any solution?