Forum Discussion

Oberke2380's avatar
Oberke2380
Copper Contributor
Jul 14, 2022
Solved

JSON Column Formatting help with Condition statement for displaying Hyperlink alternate txt

I have a SharePoint list, which I have a single line of text column that will contain an URL link.  To start with this column is blank and does not show on the new for item form.  It gets populated b...
  • ganeshsanap's avatar
    ganeshsanap
    Jul 15, 2022

    Oberke2380 Use this JSON: 

     

    {
        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "elmType": "div",
        "children": [
            {
                "elmType": "a",
                "style": {
                    "display": "=if(@currentField == '', 'none', 'block')"
                },
                "attributes": {
                    "href": "@currentField",
                    "target": "_blank"
                },
                "txtContent": "Whiteboard"
            },
            {
                "elmType": "span",
                "style": {
                    "display": "=if(@currentField == '', 'block', 'none')"
                },
                "txtContent": "Creating Whiteboard"
            }
        ]
    }

     


    Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Resources