0

I'm just getting into column formatting. I'm trying to create the "Create clickable actions" example that was on Microsoft's site explaining Column Formatting in Modern SharePoint Sites using JSON. the example itself is very straight forward, but when I apply it all values in the column disappear. There were values in the column before applying the formatting.

I tried to recreate the same formatting on my Office Developer SharePoint subscription and I had no issues applying and seeing the formatting.

Any suggestions why I wouldn't be able to apply column formatting on an on-premise 2019 server, but I can apply it to an SP online list?

I did update the schema to account for SP 2019 as specified in the documentation ("$schema": "https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json")

Below is the JSON for the column formatting. I've also tried to change @currentField to [$Stocks] (the internal name of the column) without success:

 {
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json",
   "elmType": "a",
   "txtContent": "@currentField",
   "attributes": {
      "target": "_blank",
      "href": "='http://finance.yahoo.com/quote/' + @currentField"
   }
}
2
  • 1
    Can you please add your current JSON code to your question? It will be easier to answer by looking at the JSON. – Ganesh Sanap Jun 10 at 5:02
  • 1
    Absolutely. I've added it to the post. – Matt Jun 10 at 12:37
2

All Excel-style expressions begin with an equal (=) are only available in SharePoint Online (not in SharePoint 2019).

In SharePoint 2019, you have to use the Abstract Syntax Tree (AST) expressions.

So try using below JSON:

{
   "$schema": "https://developer.microsoft.com/json-schemas/sp/v1/column-formatting.schema.json",
   "elmType": "a",
   "txtContent": "@currentField",
   "attributes": {
      "target": "_blank",
      "href": {
          "operator": "+",
          "operands": [
              "http://finance.yahoo.com/quote/",
              "@currentField"
          ]
      }
   }
}

Reference: SharePoint 2019 On Prem - Modern experience - Conditional Formatting not working

1
  • 1
    Fantastic!! Works like I originally hoped it would! – Matt Jun 10 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.