botframeworkmicrosoft-teamsadaptive-cards

Is it possible to display dynamic data in Input.ChoiceSet in Adaptive Card


Is there a way to render Input.ChoiceSet in Adaptive Card with dynamic values? We want make an api call to get the values to be shown as choices in the choice-set


Solution

  • Currently, Adaptive Cards do not support directly rendering dynamic values in an Input.ChoiceSet through an API call. However, you can use the templating feature of Adaptive Cards to bind the choices dynamically.

    Example:

      {
          "type": "AdaptiveCard",
          "version": "1.4",
          "body": [
            {
              "type": "Input.ChoiceSet",
              "id": "dynamicChoiceSet",
              "choices": "${data.choices}", // Data binding to bind dynamic choices here
              "style": "expanded",
              "isMultiSelect": false
            }
          ]
        }
    

    Ref Doc: