Building and customizing solutions using Microsoft 365 Copilot APIs and tools
I have used custom variables too but still i guess it's the json parsing issue. Because if i write the same in Topic.variableName in formula card it works completely fine
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi there,
I am developing with Copilot Studio.
When user submit a question e.g. "Where do I find XYZ?", a Topics is triggered.
In this topic I added "Ask with Adaptive Card".
I have a TextBox where I want to show a message which contains user query/prompt.
Following is my approach, which did not work.
I am sorry. I could not find any similar question to:
${System.Activity.Text}
How can I assist you further?
I also tried with ${Activity.Text} {{${Activity.Text}} {{${System.Activity.Text}} all variations do not work.
So how can I reference/display variables that were set before calling Adaptive Card?
Aykut
Building and customizing solutions using Microsoft 365 Copilot APIs and tools
I have used custom variables too but still i guess it's the json parsing issue. Because if i write the same in Topic.variableName in formula card it works completely fine
Thank you Karan, unfortunately, it does not work.
I set up the variable:
and afterwards I created the Adaptive Card:
{
"type": "AdaptiveCard",
"$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "I am sorry. I could not find any similar question to:",
"wrap": true
},
{
"type": "Input.Text",
"value": "${userPrompt}",
"id": "inputId",
"isMultiline": true
},
{
"type": "TextBlock",
"text": "How can I assist you further?",
"wrap": true,
"maxLines": 0
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Choice 1",
"value": "c1"
},
{
"title": "Choice 2",
"value": "c2"
}
],
"placeholder": "Please select",
"isRequired": true,
"errorMessage": "Please select a choice.",
"label": "Next Step:",
"id": "choiceId"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Submit"
}
],
"horizontalAlignment": "Right"
}
]
}
and this is what I got:
I tried both variations
${userPrompt}
and
${Topic.userPrompt}
But it does not work. I see literarly the variable name and not the content of the variable.
Where do I do this? I think this is the missing step I have not done, any tutorial or screenshot?
In the "Ask with Adaptive Card" action configuration:
- Look for the Variables or Data section
- Map your
UserQueryvariable to be available in the card
Under Edit Schema:
I added the variable, but still not working:
kind: Record
properties:
actionSubmitId: String
choiceId: String
userPrompt: String
Any further idea?
Many Thanks!
Aykut
Hi Aykut,
In Copilot Studio, system variables like System.Activity.Text cannot be directly referenced within Adaptive Cards. You need to pass them through a custom variable first.
Solution Steps:
Before your "Ask with Adaptive Card" action, add a "Set a variable value" action:
UserQuery)System.Activity.TextIn the "Ask with Adaptive Card" action configuration:
UserQuery variable to be available in the cardUse the proper syntax ${UserQuery}:
{
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"text": "I am sorry. I could not find any similar question to:",
"wrap": true
},
{
"type": "Input.Text",
"id": "userQuestion",
"value": "${UserQuery}",
"isMultiline": true,
"isReadOnly": true
},
{
"type": "TextBlock",
"text": "How can I assist you further?",
"wrap": true
}
]
}
Key Points:
${VariableName} syntax in Adaptive Cards, not ${System.VariableName}This approach will display the user's original query in your Adaptive Card TextBox.
If you're still having issues, please share how you've configured the variable mapping in the "Ask with Adaptive Card" action.
Hope this helps!
Thanks,
Karan Shewale.
*************************************************************************
If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.