Use System variables in Adaptive Card

2025-07-20T11:07:20.07+00:00

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

Microsoft Copilot | Microsoft 365 Copilot | Development

3 answers

Sort by: Most helpful
  1. ramisha rahat 0 Reputation points
    2026-06-10T21:11:36.56+00:00

    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

    Was this answer helpful?

    0 comments No comments

  2. Arslan,Aykut (MED MA) BII-DE-I 0 Reputation points
    2025-07-21T11:54:27.8666667+00:00

    Thank you Karan, unfortunately, it does not work.

    I set up the variable:
    User's image

    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:
    User's image

    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 UserQuery variable to be available in the card

    Under Edit Schema:
    User's image

    I added the variable, but still not working:

    kind: Record
    properties:
      actionSubmitId: String
      choiceId: String
      userPrompt: String
    

    Any further idea?

    Many Thanks!
    Aykut

    Was this answer helpful?


  3. Karan Shewale 2,585 Reputation points Microsoft External Staff
    2025-07-21T10:08:05.9166667+00:00

    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:

    1. Create a Variable to Store the User's Input

    Before your "Ask with Adaptive Card" action, add a "Set a variable value" action:

    • To: Create a new variable (e.g., UserQuery)
    • Value: System.Activity.Text
    1. Pass the Variable to Your Adaptive Card

    In the "Ask with Adaptive Card" action configuration:

    • Look for the Variables or Data section
    • Map your UserQuery variable to be available in the card
    1. Reference the Variable in Your Adaptive Card JSON
    Use 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:

    • System variables must be stored in custom variables first
    • Use ${VariableName} syntax in Adaptive Cards, not ${System.VariableName}
    • Ensure the variable is mapped in the card's data context

    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. 

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.