Hi all,
I have an interesting use case with Copilot Studio that I've been struggling to fully realize. I'm unsure if this is even possible in the platform, so turning to the community for guidance.
Context:
Our team creates and maintains automations within our organization. Most of the automations are scheduled, but we want to also allow users to trigger their automations on demand -- enter Copilot Studio. We have created a Copilot that users can interact with in Teams in order to trigger the automations they are approved to trigger. The core functionality works well, but many of our automations require startup parameters from the user. The number and format of the parameters will vary, depending on which automation is selected. Some automations may require a start date (as date type) and an input string (as text type), while others may require three separate boolean selections and a date, etc.
To work around this, we came up with a lightweight JSON template that can be used to create an Adaptive Card from Copilot Studio. The idea is that the general structure of each adaptive card will remain the same, but the questions asked -- as well as the input method (Input.Text, Input.Date, Input.ChoiceSet, etc.) -- will be unique to its accompanying automation. Each automation will have its own JSON code to populate a unique adaptive card. Below is an example of the JSON code for a test automation, as well as the Adaptive Card it produces.
Code:
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "BOT250 Copilot Studio Test",
"weight": "bolder",
"size": "medium",
"style": "heading",
"wrap": true
},
{
"type": "TextBlock",
"text": "Please update your BOT's startup variables as needed",
"isSubtle": true,
"wrap": true
},
{
"type": "TextBlock",
"text": "Some other placeholder text.",
"isSubtle": true,
"wrap": true,
"size": "small"
},
{
"type": "Container",
"items":
[
{
"type": "Input.Date",
"label": "Run Date",
"placeholder": "Choose the date you'd like to run",
"id": "Run Date",
"errorMessage": "Something went wrong",
"isRequired": true
},
{
"type": "Input.ChoiceSet",
"style": "Expanded",
"label": "Run Routine 1?",
"id": "Run_Routine1",
"isRequired": true,
"choices": [{"title": "Yes", "value": "yes"}, {"title": "No", "value": "no"}],
"errorMessage": "Something went wrong"
},
{
"type": "Input.ChoiceSet",
"style": "Expanded",
"label": "Run Routine 2?",
"id": "Run_Routine2",
"isRequired": true,
"choices": [{"title": "Yes", "value": "yes"}, {"title": "No", "value": "no"}],
"errorMessage": "Something went wrong"
},
{
"type": "Input.ChoiceSet",
"style": "Expanded",
"label": "Run Routine 3?",
"id": "Run_Routine3",
"isRequired": true,
"choices": [{"title": "Yes", "value": "yes"}, {"title": "No", "value": "no"}],
"errorMessage": "Something went wrong"
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
]
}
Adaptive Card Output:
At runtime, the correct JSON code is imported as a string (var: 'JSON'), and then parsed in Copilot Studio to a record variable 'ParsedJSON'.
The conversation then moves to an 'Ask with Adaptive Card' node, which is populated by the Topic.ParsedJSON record variable:
From here, the idea is the Copilot can call a Power Automate Flow to update the startup parameters submitted by the user.
Problem Statement:
Due to the dynamic nature of the variables collected by these adaptive cards, we are unsure of how to reliably handle the outputs from the Adaptive Card 'Submit' action back to Copilot Studio. In the example provided above, we would expect 4 total outputs (1 date and 3 strings -- I'm less worried about the actionSubmitId string):
Again though, some cards may need to produce just 2 outputs (both dates, for example).
Is there any way to work around this issue so that the Adaptive Card node can create dynamic outputs that can still be used by the Copilot? I am open to any workarounds, questions, or advice on this topic. Likewise, if there is a better solution outside of this method that would achieve the same goal, I would love to discuss.
Thank you in advance for your help!
Hi @Umianta ,
Thank you for your reply! This would certainly work, but we're hoping to avoid updating the Copilot's logic each time we add a new BOT to the program. Ultimately, we would like to have just 1 adaptive card node that generates the adaptive card dynamically based on the JSON file housed with the rest of the Automation's details in Sharepoint. Is there any way to achieve this so we have control over the output variables coming from the adaptive card node?
Alternatively, is there any way to concatenate all of the question & answer pairs from the Adaptive card into a single string before sending back to Copilot? Something like the following would work, and then we could parse as needed: [AC_Output] = "[{"Question 1", "Answer 1"}, {"Question 2", "Answer2"}]"
Thank you!
Hi @jscheidl
You can offer users the choice to select the automation they wish to execute. Depending on their selection, you can generate the corresponding adaptive card and capture their response in a variable. See the example below for clarification.
If this was helpful:
⭐Please mark it as a solution
⭐Give me a thumbs-up
⭐Connect on LinkedIn
⭐I consistently upload technical videos. If you're interested, please visit and subscribe to my YouTube Channel
⭐Always glad to help, Umesh Khandelwal!
Great question and use case. **Commenting to be in loop when the solution is reached.
Pablo Roldan
27
Romain The Low-Code...
25
stampcoin
10