Seeing [Object Object] in some columns in a list on my sharepoint site

McClure, Christopher 0 Reputation points
2024-04-01T12:58:56.7166667+00:00

hi there, I am not sure if I have posted in the right place. 

 

I am setting up a sharepoint site that has a list to track users going onto different physical sites. The user will give an estimated time for them leaving site and if the current time goes past said time the full row should go red. I was able to get it to work for some columns but I can't for those those that are multiple choice (Site name and Visitor Name has a linked list that stores all the site names and all the user names, the users names have their phone numbers and company they work for attached to them).

 

The JSON code below is what works on company as thats just a free text box. but not on Site name as that is a Lookup type:

 

 


{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "color": "=if([$Estimated_x0020_Exit_x0020_Time] <= @now, 'red',if([$Estimated_x0020_Exit_x0020_Time] <= @now + 1800000 && [$Estimated_x0020_Exit_x0020_Time] > @now,'orange','green'))",
    "font-weight": "=if([$Estimated_x0020_Exit_x0020_Time] <= @now, 'bold',if([$Estimated_x0020_Exit_x0020_Time] <= @now + 1800000 && [$Estimated_x0020_Exit_x0020_Time] > @now,'semi-bold','normal'))"
  }
}
Microsoft 365 and Office | SharePoint | For business | Windows
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,241 Reputation points Microsoft External Staff
    2024-04-02T07:56:45.9966667+00:00

    Hi @McClure, Christopher ,

    Thank you for posting in this community.

    If you want the entire line to turn red if the current time exceeds the estimated time, use the following view json format.

    Here are steps:

    1."All Items"->"Format current view"

    User's image

    2."Advanced mode"User's image

    3.Use the following view json format.

    {   
    
       "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    
       "additionalRowClass": "=if([$data] <= @now, 'sp-field-severity--blocked',if([$data] <= @now + 1800000 && [$data] > @now,'sp-field-severity--warning', 'sp-field-severity--good'))" 
    
    
    }
    

    User's image

    Reference: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-list-formatting


     If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.