Can i edit Adaptive card Choices dynamically? If yes how?

Kokul Jose 311 Reputation points
2020-08-16T09:22:06.283+00:00

I have an Input.ChoiceSet in my adative card. I want to edit the choices and may the number of choices reduced after editing. How can I edit the card and reduce the number of choices and change the choice values?

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
737 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. romungi-MSFT 41,736 Reputation points Microsoft Employee
    2020-08-18T12:56:27.85+00:00

    anonymous user I think editing of the choices is restricted for the choiceSet from the client side. You can try a different way to take the inputs like inputs with validation and restrict the number of choices to the ones that are only required and others as optional along with show cards.

    3 people found this answer helpful.
    0 comments No comments

  2. Paul Smoothy 6 Reputation points
    2021-11-05T02:29:53.88+00:00

    Not sure which part you mean @Baum, Joel (J) , but this is how I get a list of items
    146680-image.png

    Then this is how I use the variable in the JSON of a Teams adaptive card.
    The output is from the Compose where the list of items from my previous post are collected, but the first "," stripped off to make it valid JSON.

    Hope that helps.
    146704-image.png

    1 person found this answer helpful.
    0 comments No comments

  3. Paul Smoothy 6 Reputation points
    2021-05-09T23:17:32.067+00:00

    Hi K,

    I'm not sure if this is what you were exactly asking for, but it may be tailored for your situation.

    I wanted to make a dynamically created set of choices in an adaptive card and get a user response.

    This is how I did it.

    Loop through list items to get the data I wanted, then for each item verify that it is correct (for me I wanted to make sure I didn't collect any that had missing information so I checked for "null" value and if it was null then do nothing. If Flow found a value that should be included then append to a string variable code like this:
    94949-image.png

    Then after looping through all the values I used a Compose (substring(variable), 1) to remove the leading "," and that left me with valid JSON to insert into the choices section of the adaptive card.

    Hope that helps, though you may already have figured it out.

    Regards,
    Paul