0

Some data from other fields can't be reference when using JSON to format Sharepoint List columns. What is being done wrong?

For Person fields

"@currentField.title"         Works
"@currentField.email"         Works
"[$ThisField.title]"          Works
"[$ThisField.email]"          Works
"[$OtherField.title]"         Doesn't work

For Text fields

"[$OtherField]"               Works for some but not others

For Number fields

"[$OtherField]"               Doesn't work

For Calculated fields

"[$OtherField]"               Doesn't work
"[$OtherField.lookupvalue]"   Doesn't work

Here is my code, which I've labelled on the left with Yes/No on whether the reference to a variable actually works:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "span",
      "style": {
        "padding-right": "8px"
      },
Y      "txtContent": "[$Owner.title]"
    },
    {
      "elmType": "a",
      "attributes": {
        "iconName": "Mail",
        "class": "sp-field-quickActions",
        "href": {
          "operator": "+",
          "operands": [
            "mailto:",
Y           "@currentField.email",
            "?subject=Task status&body=You are marked as owner of this task. Reminder prompt activated.\r\n---\r\n",
            "Raised by: ",
N           "[$OtherPersonField.title]",
            "\r\nOwner: ",
Y           "[$ThisPersonField.title]",
            " and Issue Detail %2D ",
Y           "[$ThisPersonField.email]",
            "\r\nPriority: ",
Y           "[$TextFieldA]",
            "\r\nContext: ",
N           "[$ACalculatedField]",
            " at ",
N           "[$TextFieldB]",
            "\r\nIssue: Checklist No. %2D ",
N           "[$NumberField]",
            " and Issue Detail %2D ",
N           "[$LongTextField]",
            "\r\nClick this link for more info. https://PATH.sharepoint.com/sites/SITE/Lists/LIST/VIEW.aspx?web=1%26useFiltersInViewXml=1%26FilterField1=ThisPersonField%26FilterValue1=",
Y           "@currentField.title",
            "%26FilterType1=User%26FilterOp1=In"
          ]
        }
      }
    }
  ]
}

All of the fields that I am trying to reference are shown in the current view.

Your Answer

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

Browse other questions tagged or ask your own question.