Forum Discussion

Kundanm1's avatar
Kundanm1
Copper Contributor
May 03, 2023

Json code not working

I want on my column to show SDS not the link i used the json code below but still not working

 

{

   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

   "elmType": "span",

   "txtContent": "[$SDS]",

   "attributes": {

      "target": "_blank",

      "href": "@currentField"

   }

}

1 Reply

  • Kundanm1's avatar
    Kundanm1
    Copper Contributor
    I had also tried this code but still not working
    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    "elmType": "div",
    "children": [
    {
    "elmType": "span",
    "txtContent": "NA",
    "style": {
    "display": "=if(@currentField, 'none', 'block')"
    }
    },
    {
    "elmType": "a",
    "attributes": {
    "href": "@currentField",
    "target": "_blank"
    },
    "txtContent": "SDS",
    "style": {
    "display": "=if(@currentField, 'block', 'none')"
    }
    }
    ]
    }

Resources