Question

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.

Was it helpful?

Solution

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]

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top