Forum Discussion
Adaptive Card: Input Toggle default value not working in Agent Chat
Hello!
I am building a custom Copilot agent that analyzes documents for specific data points.
Goal
- Have an Adaptive Card display the list of pre-defined data points and allow the user to check/uncheck the data points as needed.
- Each checkbox is checked (value="true") by default
Issue
- Check boxes are always unchecked by default (value="false")
- When I add (valueOn: "true") and (valueOff: "false") in my JSON in the card editor, it is immediately deleted from the JSON payload upon clicking "save".
In the Agent Builder canvas, the check boxes are correctly shown as checked by default. But in the test chat, they are no longer checked (picture below).
Any suggestions on how to have the boxes checked by default? Or is this not possible?
{
"type": "AdaptiveCard",
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "Data Point to Extract",
"wrap": true
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "Input.Toggle",
"title": "Data Point 1",
"value": "true",
"id": "Data Point 1"
},
{
"type": "Input.Toggle",
"title": "Data Point 2",
"value": "true",
"id": "Data Point 2"
},
{
"type": "Input.Toggle",
"title": "Data Point 3",
"value": "true",
"id": "Data Point 3"
},
{
"type": "Input.Toggle",
"title": "Data Point 4",
"value": "true",
"id": "LenderResp"
},
{
"type": "Input.Text",
"placeholder": "Enter Custom Data Point",
"id": "CustomText"
}
]
}
]
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Submit",
"id": "SubmitButton"
}
]
}
]
}
2 Replies
- JemSillabubIron Contributor
Configure the value property in the Adaptive Card JSON and use the coalesce function to handle null values to fix the toggle control default value issue. Simultaneously, check the variable passing logic in Power Automate or Copilot Studio.
- ChrisL10Brass Contributor
Hi Andrew,
If you publish the agent to Teams / Microsoft 365, you should see the options are checked there, I just tested it myself. They just appear unchecked in Copilot Studio for some reason.
I was however getting an InvalidPropertyPath error with your JSON, which Copilot updated it to the below so it would work:
{ "type": "AdaptiveCard", "$schema": "https://adaptivecards.io/schemas/adaptive-card.json", "version": "1.5", "body": [ { "type": "TextBlock", "text": "Data Point to Extract", "wrap": true }, { "type": "ColumnSet", "columns": [ { "type": "Column", "width": "stretch", "items": [ { "type": "Input.Toggle", "title": "Data Point 1", "value": "true", "id": "dataPoint1" }, { "type": "Input.Toggle", "title": "Data Point 2", "value": "true", "id": "dataPoint2" }, { "type": "Input.Toggle", "title": "Data Point 3", "value": "true", "id": "dataPoint3" }, { "type": "Input.Toggle", "title": "Data Point 4", "value": "true", "id": "lenderResp" }, { "type": "Input.Text", "placeholder": "Enter Custom Data Point", "id": "customText" } ] } ] }, { "type": "ActionSet", "actions": [ { "type": "Action.Submit", "title": "Submit" } ] } ] }Key Fixes:
- Changed id values like "Data Point 1" to "dataPoint1" (no spaces).
- Removed the id from the Action.Submit button — it's not needed and can cause issues.