How can I use "Only show when" on adaptive card

Viewed 4034
2 Answers

Without seeing more of your card, I think you need to remove the second $. Here's a very simple example:

Card:

{
    "type": "AdaptiveCard",
    "body": [
        {
            "type": "TextBlock",
            "size": "Medium",
            "weight": "Bolder",
            "text": "${title}",
            "$when": "${showTitle == true}"
        }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.3"
}

Data:

{
    "title": "This is a title",
    "showTitle": true
}

If you change showTitle to false in the data, the text will no longer show.

if you like to use 'if not' logic, here is the example

"$when": "${$root.variableName != \"test\"}"

The block will show if the value is not "test"

Related