Question

I have a field that I want linked to either the NewForm or the EditForm

If it is null, the link generated will point to NewForm.aspx, if it has a value, I want it to point to EditForm.aspx with the ID concatenated. This condition works, but how do I concatenate the ID? I tried nesting another condition with "+" as the operator, but I get an error

Here is the syntax for checking the current field value which generates a link button successfully:

{
  "elmType": "a",
  "txtContent": "",
  "attributes": {
    "target": "_blank",
    "iconName": "OpenInNewWindow",
    "class": "sp-field-quickAction",
    "href": {
        "operator": "?",
        "operands": [
                {
                    "operator": "==",
                    "operands": [
                        "@currentField",
                        ""
                  ]
                },
              "NewForm.aspx",
              "EditForm.aspx?ID= + @currentFieldValue" => HOW DO I APPEND THE ID?
      ]
    }
  }
}
Was it helpful?

Solution

"='EditForm.aspx?ID=' + @currentField"

Note the = as the first item in the quotes, which makes it an expression. You can then use single quotes and plus signs to concatenate. also, note that its @currentField, not @currentFieldValue. (entering @currentFieldValue will NOT generate an error, but will simply make it not resolve, and so @currentFieldValue will be in the output as a string)

edit: I think I misread. If currentfield isn't the id, you can get the id via:

"='EditForm.aspx?ID=' + [$ID]"
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top