web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / How to include a varia...
Copilot Studio
Suggested Answer

How to include a variable into message of Teams Adaptive Card?

(0) ShareShare
ReportReport
Posted on by
I'm using latest version of Copilot Studio and developing an agent Flow with action: Post a Teams adaptive card and wait for a response.
 
I would like to use my own variable with JSON code below:
"title": "Request Type:",
"value": "${requestType}"


But it keeps gave error message. Any buddy knows what should be the correct grammar?
I have the same question (0)
  • Suggested answer
    Vish WR Profile Picture
    3,507 on at
     

    The ${requestType} syntax is the problem that's Adaptive Card templating, which Copilot Studio doesn't process, so it leaves it as literal text. Copilot Studio uses Power Fx instead.

     

    In the card's Formula (Power Fx) editor, drop the ${} and reference the variable directly, no quotes:

    text: "Request Type: " & Topic.requestType

    Use Topic.requestType for a topic variable or Global.requestType for a global one, and join text with &. If the value comes from an agent flow, map the flow output to a topic variable first, then reference it the same way.

     

    Reference (Microsoft Learn): https://learn.microsoft.com/en-us/microsoft-copilot-studio/advanced-proactive-message

    Please  Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like 
    Visit my blog My Tech Space    LinkedIn  
  • Nivedipa-MSFT Profile Picture
    Microsoft Employee on at
    Hello ,

    ${requestType} uses Adaptive Card templating syntax, and the "Post adaptive card and wait for a response" action does not evaluate it, so it shows up as literal text.

    Instead, use Power Automate expression syntax:

    Here are the variants based on the source:

    • Variable → @{variables('requestType')}
    • Trigger input → @{triggerBody()?['requestType']}
    • Previous action → @{outputs('ActionName')?['body/requestType']}

    Tips:

    • Keep the double quotes around @{...} so the JSON stays valid.
    • If the value can be null: "@{coalesce(variables('requestType'),'')}"
    • If it isn't a string: "@{string(variables('requestType'))}"

    The easiest approach is to click the value field in the action and choose the variable from the dynamic content panel — it inserts the correct @{...} for you.

  • Suggested answer
    chiaraalina Profile Picture
    2,318 Super User 2026 Season 1 on at
     
    The syntax depends on where you're creating the Adaptive Card:
     
    • In a Topic in  Copilot Studio Native Cards when you use the"Ask with Adaptive Card" node directly:
     
    Power Fx formula syntax
    Make sure you choose Formula card as format and then you can reference the variable.
     
     
    • In Power Automate/Agent Flows with Post Adaptive Card and Wait for Response
    Power Automate expression syntax
     
    For example use use @{variables('variableName')} or also dynamic content.
     
     
     
    The ${variableName} syntax you tried is part of the Adaptive Cards Template Language, which is a separate data-binding system for Adaptive Cards. For example when you author a card template then you can use it. 
     
    Hope it helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 249

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 180 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 153

Last 30 days Overall leaderboard