0

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?
      ]
    }
  }
}
1
"='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]"
  • Awesome thanks. Simple concatenation but this syntax is killing me trying to work with long URLs in a tiny editor – Michael Colbs Aug 27 '19 at 18: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.