2

I am using SharePoint 2019. I want to create a clickable action column like referenced in https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#create-clickable-actions.

For reference I rebuild the example given by Microsoft. When I insert the JSON formatting the content of my field disappears.

When I remove the @currentField the link works, but without the information of the field of course.

Screenshots

Now I'm wondering why it is not working, even though I rebuild the example given.

1 Answer 1

2

As you are using SharePoint 2019, Excel-style expressions will not work, hence you have to use Abstract Syntax Tree (AST) expressions.

So, use JSON like this:

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

Read more about excel style expressions and Abstract Syntax Tree (AST) expressions at:

  1. Excel-style expressions
  2. Abstract Syntax Tree expressions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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