Forum Discussion

hrt13's avatar
hrt13
Copper Contributor
Jul 09, 2020

Problem formatting list with JSON

The following code in my JSON formatting file causes the list to disappear,

 

"txtContent": "=if([$Medium] == 'In-Person', 'Reason for requesting in-person: ' + [$in_x002d_personjustification], '')"

 

If I remove [$in_x002d_personjustification], or replace it with text, i.e., '[in_x002d_personjustification]' the list works with the correct formatting.

 

I have tried removing all records and creating a new one with a value in [$in_x002d_personjustification] (column name, "in-person justification"), the list still does not appear. I have seen this happen when the column name doesn't exist in the Sharepoint list, but that doesn't seem to be the problem here, unless I'm missing something.

  • hrt13I just figured it out. I had to "Edit the current view" and check the "Display" box next to the column. :facepalm: Hopefully, I'll remember that next time.

  • You need to access the data from another column using it's internal name like: 

     

    [$InternalNameOfColumn]

     

    Also, make sure that you have added all the columns you are using in JSON formatting in your list view. (From list view settings).

     

    Use column formatting to customize SharePoint 


    Please click Mark as Best Response & Like 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.

    For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

    • hrt13's avatar
      hrt13
      Copper Contributor

      ganeshsanapthanks for the response. I was using the internal name for the column, but I forgot to "display" the column., (as I said in my last post). Thanks for responding though.

  • hrt13's avatar
    hrt13
    Copper Contributor

    hrt13I just figured it out. I had to "Edit the current view" and check the "Display" box next to the column. :facepalm: Hopefully, I'll remember that next time.

    • hrt13's avatar
      hrt13
      Copper Contributor

      BB-SPDevjust tried it, same problem. Thanks though. I realized I should have mentioned the column holds multi-line text items.

  • hrt13's avatar
    hrt13
    Copper Contributor
    UPDATE: I just tried creating a different column (this one I named reason), putting some text in it, then changing the JSON, the preview worked, but when I saved it, I got the same problem.

Resources