Forum Discussion
JSON choice column conditional hyperlink formatting
iparker Try the attached JSON. You would get an image next to the to Do Item. On clicking that image you will be redirected to the page. You can also change the background of the to-do value..
{
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "0 2px"
},
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toLowerCase",
"operands": [
"[$Status]"
]
},
{
"operator": "toLowerCase",
"operands": [
"To Do"
]
}
]
},
"sp-css-backgroundColor-blockingBackground50",
"sp-css-backgroundColor-neutralBackground"
]
}
},
"children": [
{
"elmType": "a",
"attributes": {
"iconName": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toLowerCase",
"operands": [
"[$Status]"
]
},
{
"operator": "toLowerCase",
"operands": [
"To Do"
]
}
]
},
"ArrowUpRight8",
""
]
},
"class": "sp-field-quickActions",
"target": "_blank",
"href": "https://www.google.com/"
},
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toLowerCase",
"operands": [
"[$Status]"
]
},
{
"operator": "toLowerCase",
"operands": [
"To Do"
]
}
]
},
"",
""
]
}
},
{
"elmType": "span",
"style": {
"padding": "0 2px"
},
"txtContent": "@currentField",
"attributes": {
"class": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
{
"operator": "toLowerCase",
"operands": [
"[$Status]"
]
},
{
"operator": "toLowerCase",
"operands": [
"To Do"
]
}
]
},
"",
""
]
}
}
}
]
}
- JoshSullivanOct 06, 2020Copper Contributor
The image didn't load for me... how can I reference the image?
- iparkerApr 29, 2020Copper Contributor
Maruthi GaddeYou are a LEGEND. This is perfect and easy to edit, thank you!