1

I want to format a column using JSON to add a Workflow Start LINK but can not change the element ID dynamically. Can someone please help?

{
    "elmType": "a",
    "txtContent": "",
    "attributes": {
        "target": "_blank",
        "iconName": "OpenInNewWindow",
        "class": "sp-field-quickAction",
        "href": {
            "operator": "+",
            "operands": [
                "http://intranet.maib.local/sites/help/Workflows/preluareElement/preluareElement.aspx?List={7a9edd38-3f18-4bef-99f6-062067196fa2}&ID=",["$ID"],
                "&ItemGuid={690E069D-F5E7-45B3-9BED-123844A03316}&TemplateID={dbe5af40-944e-4a76-afa4-df336141cbf6}&Source=http%3A%2F%2Fintranet%2Emaib%2Elocal%2Fsites%2Fhelp%2FLists%2FCerere%2520de%2520suport%2FAllItems%2Easpx",
                "@currentField"
            ]
        }
    }
}

If I remove [$ID] and write a correct element id everything works as expected.

Thank you very much.

1
  • Try using "[$ID]". let me know if it works. Apr 6, 2020 at 12:46

1 Answer 1

1

Try using it like this:

{
    "elmType": "a",
    "txtContent": "",
    "attributes": {
        "target": "_blank",
        "iconName": "OpenInNewWindow",
        "class": "sp-field-quickAction",
        "href": {
            "operator": "+",
            "operands": [
                "http://intranet.maib.local/sites/help/Workflows/preluareElement/preluareElement.aspx?List={7a9edd38-3f18-4bef-99f6-062067196fa2}&ID=","[$ID]",
                "&ItemGuid={690E069D-F5E7-45B3-9BED-123844A03316}&TemplateID={dbe5af40-944e-4a76-afa4-df336141cbf6}&Source=http%3A%2F%2Fintranet%2Emaib%2Elocal%2Fsites%2Fhelp%2FLists%2FCerere%2520de%2520suport%2FAllItems%2Easpx",
                "@currentField"
            ]
        }
    }
}

Reference: Use column formatting to customize SharePoint - "[$FieldName]"

The column is formatted within the context of the entire row. You can use this context to reference the values of other fields within the same row by specifying the internal name of the field surrounded by square brackets and preceded by a dollar sign, like: [$InternalName]

You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

1
  • 1
    Tank you it worked like a charm
    – Vasile
    Apr 6, 2020 at 13:15

Your Answer

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

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