Share via

SharePoint JSON Code Error

Anonymous
2021-03-01T19:15:01+00:00

I am getting the following error in one of my cells when I try to write my own code into SharePoint :

"Failure: Method Date.prototype.toLocaleString called on incompatible receiver [object Object]"

The following is my code: 

{

 "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",

 "elmType": "div",

 "debugMode": true,

 "txtContent": "@currentField",

 "attributes": {

 "class": "= if(Number(@currentField) == 0, '' , if(@currentField< [$Date], 'sp-css-backgroundColor-blockingBackground50', ''))"

 }

}

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-03-02T01:34:05+00:00

    Hi ninx-da,

    Thanks for asking the question in our community forum.

    Per your description, you encountered an error when writing SharePoint JSON code. As our forum focus on how to deal with the out-of-box issue of Office 365, we are really sorry for couldn't provide a good suggestion for you. We sincerely recommend you raise this in SharePoint Online – Microsoft Q&A. Questions about programming, development, database and so on can all get answered there. Experts there would conduct in-depth research on the problem you encountered and provide you with more professional assistance.

    Best regards,
    Madoc

    Was this answer helpful?

    0 comments No comments