自适应卡片中的动态选择集“将自适应卡片发布给团队用户并等待响应”

时间:2021-03-25 15:07:30

标签: power-automate adaptive-cards

我有以下用于自适应卡的 JSON 代码。我将其放入“撰写”数据操作中,然后使用“将您自己的自适应卡作为 Flow bot 发布给用户”并成功运行。但是,当您想等待响应时,使用此 REST API 不起作用。因此,我尝试使用“向 Teams 用户发布自适应卡片并等待响应”,但是当我尝试使用下面的以下 JSON 代码时,它给了我一个错误...“[验证] 输入。 ChoiceSet 必须至少定义一个选项。"

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.2",
  "body": [
    {
      "type": "TextBlock",
      "size": "Medium",
      "weight": "Bolder",
      "text": "Input.Text elements",
      "horizontalAlignment": "Center",
      "wrap": true
    },
    {
      "type": "TextBlock",
      "text": "Part #",
      "wrap": true
    },
    {
      "type": "Input.ChoiceSet",
      "id": "choiceSelect",
      "choices": @{variables('ArrayTest')}
    },
    {
      "type": "TextBlock",
      "text": "Due Date",
      "wrap": true
    },
    {
      "type": "Input.Date",
      "id": "DateVal"
    },
    {
      "type": "TextBlock",
      "text": "Start time",
      "wrap": true
    },
    {
      "type": "Input.Time",
      "id": "TimeVal"
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "Submit"
    }
  ]
}

所以在收到这个错误后,我试图操纵代码,结果我把ChoiceSet改成了这个

    {
        "type": "Input.ChoiceSet",
        "id": "choiceSelect",
        "choices": [
            {
                "title": "@{variables('ArrayTest')}",
                "value": "@{variables('ArrayTest')}"
            }
        ]
    }

而且我没有收到 Adaptive Card 中的错误,而是 Power Automate 错误...

“请求失败。错误代码:‘InvalidJsonInBotAdaptiveCard’。错误消息:‘Microsoft.Azure.ProcessSimple.Data.Entities.Exceptions.ProcessSimpleDataException:指定的 Teams flowbot 自适应卡请求丢失或无效。跟踪Id 为“{0}”。---> Newtonsoft.Json.JsonReaderException:解析值后遇到意外字符:t.路径“body[2].choices[0].title”,第 1 行,位置 356 ."

我的问题是...如何在使用“等待响应”的同时使用动态选择集?我可以在“将您自己的自适应卡片作为 Flow 机器人发布给用户”而不是“将自适应卡片发布给 Teams 用户并等待响应”中成功获得它

enter image description here

0 个答案:

没有答案