Copilot Studio: Convert Table Variable to String from Adaptive Card to Agent Flow
Introduction
When building solutions in Copilot Studio, you may use Adaptive Cards to collect multi-choice input from users. The selected values from a multi-select field are stored as a table variable. However, if you want to pass these values to an Agent Flow (for example, to create a SharePoint list item), you need to convert the table variable into a single string.
This post shows how to concatenate the selected values from a multi-choice Adaptive Card field into a semicolon-separated string using the concat
function in a Set Variable value
action within your topic.
Solution
Suppose you have a multi-choice variable called assistiveTech
and another variable called otherAssisTech
. To combine all selected values into a single string, use the following formula:
Concatenate(Concat(Topic.assistiveTech, Text(Value), ";"), Topic.otherAssisTech)
Concat(Topic.assistiveTech, Text(Value), ";")
joins all selected values from the table with a semicolon.Concatenate(..., Topic.otherAssisTech)
appends the value ofotherAssisTech
to the result.
Passing the String to an Agent Flow
Once you have the concatenated string, you can easily pass it to an Agent Flow as a parameter. This allows you to create a SharePoint list item with the selected values stored as a single, semicolon-separated string.
Result
The SharePoint list item will display the concatenated multi-choice values in a single field, making it easy to store and view user selections.
Summary
- Adaptive Card multi-choice selections are stored as a table variable.
- Use the
Concat
andConcatenate
functions to convert the table to a string. - Pass the string to an Agent Flow to create SharePoint list items or for other downstream processes.
This approach streamlines handling multi-choice data from Adaptive Cards in Copilot Studio and Power Automate scenarios.