Warm tip: This article is reproduced from serverfault.com, please click

conditional visibility

发布于 2020-12-03 13:48:19

I'm trying to create a button that only appears if the "Zapůjčeno" column is empty.

    {
  "elmType": "button",
  "txtContent": "Odeslat Žádost",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"7347b7be-696f-46c8-bae8-78c230a354b3\"}"
  },
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}

Example with "ID" column

If I try it with the default column "ID" it works, but if I want to use my column "Zapůjčeno" it doesn't work.

Thank you for your advice, I am a novice in SharePoint.

Questioner
František Dolejší
Viewed
0
Rikking 2020-12-04 00:26:07

Is the column Zapůjčeno internal name the same as the display name? You can see the internal name of that column in list/library settings an then click on the column name. The internal name of this column will in the URL.

I think you can then use something like this:

{
  "elmType": "button",
  "txtContent": "= if([$Zapůjčeno_Internal_Name]=='','Odeslat Žádost', '')",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "='{\"id\": \"' + if([$Zapůjčeno_Internal_Name]=='','7347b7be-696f-46c8-bae8-78c230a354b3','') + '\"}'"
  },
"style": {
"background-color": "#03A9F4",
"color": "white",
"visibility": {
"operator": "?",
"operands": [
{
"operator": "!=",
"operands": [
"[$ID]",
"1"
]
},
"hidden",
"visible"
]
}
}
}