Power Automate - 在自适应卡中使用变量

Power Automate - using variables in adaptive cards

我正在尝试构建一个在执行以下操作的 Teams 中运行的流程:

我能够将流程中较高位置的变量插入到自适应卡中,但我很难在卡中使用带有“$when”条件的变量。这是 JSON:

{
  "type": "AdaptiveCard",
  "data": {
    "postContainsLink": "@{variables('postContainsLink')}",
    "testNum": "@{variables('testNum')}",
    "otherTestNum": "100"
  },
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "@{variables('messageBody')}",
      "$when": "${postContainsLink == true}"
    },
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "If you're seeing this text block, something went wrong. Bummer.",
      "$when": "${testNum < 100}"
    },
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "If you're seeing this text block, something else went wrong. Bummer.",
      "$when": "${otherTestNum < 50}"
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.2"
}

None 的“$when”值阻止了这些文本块中的任何一个出现。但是第一个能够成功显示消息正文。

如何使用变量显示或隐藏自适应卡片中的文本块?

你能试试吗this sample。它解释了如何 hide/show 文本块。