Skip to main content
Community site session details

Community site session details

Session Id :
Copilot Studio - General
Unanswered

How to get value from radio button and store in a variable

(1) ShareShare
ReportReport
Posted on by Super User 2024 Season 1

Hi there,

 

I'm using an adaptive card to display a form on the chatbot and there is a choice set in the form as a radio button.

 

I want to know if anyone managed to store the value of the radio button in a variable using Bot Framework Composer, so them I can pass through PVA.

 

See example below:

 

2022-04-05 09.30.26 adaptivecards.io 631c4a22f0e1.png

bfc.png

 

So, I want to store the value "Red" in a variable on Bot Framework Composer, so I can pull it from PVA.

 

Thanks,

 

Fernando

Categories:
  • fernandosilva Profile Picture
    Super User 2024 Season 1 on at
    Re: How to get value from radio button and store in a variable

    It's working now.

     

    Copy and paste as a card payload on a blank card.

     

    That was because the line below was as a single line and not on the same line than the label.

     

     

    (E.g. 128Gb, 256Gb, 1Tb)",

     

     

  • Monkeyman Profile Picture
    325 on at
    Re: How to get value from radio button and store in a variable

    Unfortunately that schema is not working for me when I put it in Designer | Adaptive Cards

  • fernandosilva Profile Picture
    Super User 2024 Season 1 on at
    Re: How to get value from radio button and store in a variable

    Hi Monkeyman,

     

    Below is my adaptive card and if you place it on here: https://adaptivecards.io/designer/, you will see how it works, but I believe the values of the variables inside the "actions" must have a different path on turn.activity.value.XXX as simply calling the user.XXX, the value is not passing through. If I take all the actions out and place all the form in a single structure, it goes fine.

     

     

     

     

     

     

    {
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "type": "AdaptiveCard",
     "version": "1.2",
     "body": [
     {
     "type": "TextBlock",
     "size": "Medium",
     "weight": "Bolder",
     "text": "My details",
     "horizontalAlignment": "Center",
     "wrap": true,
     "style": "heading"
     },
     {
     "type": "Input.Text",
     "label": "Card number",
     "id": "CardNumber",
     "isRequired": true,
     "errorMessage": "Card Number is required"
     },
     {
     "type": "Input.Text",
     "label": "First name",
     "id": "FirstName",
     "isRequired": true,
     "errorMessage": "Full Name is required"
     },
     {
     "type": "Input.Text",
     "label": "Last name",
     "id": "LastName",
     "isRequired": true,
     "errorMessage": "last Name is required"
     },
     {
     "type": "Input.Text",
     "label": "Email address",
     "style": "Email",
     "id": "Email",
     "isRequired": true,
     "errorMessage": "Email is required"
     }
     ],
     "actions": [
     {
     "type": "Action.ShowCard",
     "title": "About Your Phone",
     "card": {
     "type": "AdaptiveCard",
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "body": [
     {
     "type": "Container",
     "id": "aboutyourphone",
     "items": [
     {
     "type": "Input.Text",
     "label": "Phone Number",
     "style": "Tel",
     "id": "PhoneNumber",
     "isRequired": true,
     "errorMessage": "Phone number is required"
     },
     {
     "type": "Input.ChoiceSet",
     "choices": [
     {
     "title": "Apple",
     "value": "Apple"
     },
     {
     "title": "Samsung",
     "value": "Samsung"
     }
     ],
     "placeholder": "Placeholder text",
     "label": "Phone maker",
     "style": "expanded"
     },
     {
     "type": "Input.Text",
     "label": "What's your phone maker? (E.g. Apple, Samsung, LG)",
     "id": "PhoneMaker",
     "isRequired": true,
     "errorMessage": "Phone maker is required"
     },
     {
     "type": "Input.Text",
     "label": "What's your phone model? (E.g. S20, Pro , Mini)",
     "id": "PhoneModel",
     "isRequired": true,
     "errorMessage": "Phone Model is required"
     },
     {
     "type": "Input.Text",
     "label": "What's your phone memory capacity? (E.g. 128Gb, 256Gb, 1Tb)",
     "id": "MemoryCapacity",
     "isRequired": true,
     "errorMessage": "Memory capacity is required"
     }
     ]
     }
     ],
     "actions": [
     {
     "type": "Action.ShowCard",
     "title": "More Details",
     "card": {
     "type": "AdaptiveCard",
     "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
     "body": [
     {
     "type": "Container",
     "id": "moredetails",
     "items": [
     {
     "type": "Input.Date",
     "label": "Purchase Date",
     "id": "PuchaseDate",
     "value": "2022-22-22",
     "style": "text",
     "isRequired": true,
     "errorMessage": "Purchase date is required"
     },
     {
     "type": "Input.Text",
     "label": "Where did you purchase your device?",
     "id": "PurchasePlace",
     "isRequired": true,
     "errorMessage": "Purchase place is required"
     },
     {
     "type": "Input.Text",
     "label": "What's your device IMEI number? (Press *#06# on your phone keyboard to find out)",
     "id": "ImeiNumber",
     "isRequired": true,
     "errorMessage": "IMEI number is required"
     },
     {
     "type": "Input.Text",
     "label": "Write your message here (optional)",
     "isMultiline": true,
     "id": "Comments"
     }
     
     ]
     }
     ],
     "actions": [
     {
     "type": "Action.Submit",
     "title": "Submit",
     "data": {
     "id": "123456789011121314"
     }
     }
     ]
     }
     }
     ]
     }
     }
     ]
    }

     

     

     

     

     

  • Monkeyman Profile Picture
    325 on at
    Re: How to get value from radio button and store in a variable

    Hey Fernando

     

    You can set the turn.activity.value to a user.XXX property and then use the set property to set dialog.result.XXX to user.XXX

  • fernandosilva Profile Picture
    Super User 2024 Season 1 on at
    Re: How to get value from radio button and store in a variable

    Hey,

     

    I got that, but the radio button is inside an action where slide down to show the other fields, like this example:

    https://adaptivecards.io/samples/ShowCardWizard.html

    with the radio buttons like these ones: https://adaptivecards.io/samples/InputsWithValidation.html

     

    So, my issue is to setup the "=turn.activity.value" for the radio button variable and also to assign that variable to the "dialog.result" .

     

    I can see the variable when exporting to PVA, but the values are not passing through.

     

    Cheers,


    Fernando

     

     

  • Monkeyman Profile Picture
    325 on at
    Re: How to get value from radio button and store in a variable

    Hey

     

    you need to go to the parent topic and look at the dialog.result scope. 

    in there you can create output variables. 

    Check this post’s solution for more info - https://powerusers.microsoft.com/t5/Bot-Extensibility/Pass-variable-from-Bot-Framework-back-to-PVA/m-p/1386788#M70

     

    Please mark this topic as solved if I have helped. 

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 169 Super User 2025 Season 1

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 150

#3
sandeep_angara Profile Picture

sandeep_angara 75