Views:

Applies to Product – Microsoft Copilot Studio


What’s happening?
Customers inquire about the possibility of using dynamic URLs in buttons within Adaptive Cards.


Reason:
The underlying cause relates to the implementation of Adaptive Cards and the ability to incorporate dynamic parameters into the button URLs.


Resolution:
To use dynamic URLs in buttons within Adaptive Cards, follow these steps:

  1. Create a variable to hold the dynamic piece of the url.
  2. Change the Adaptive Card properties to Formula
          
3. Add the parameters into the Adaptive Card code. In the below example, the url is appended with Topic.TicketNumber
Use the following structure for the button URL:
{
  type: "AdaptiveCard",
  '$schema': "https://adaptivecards.io/schemas/adaptive-card.json",
  version: "1.5",
  body: [
    {
      type: "TextBlock",
      size: "Medium",
      weight: "Bolder",
      text: "Ticket Number",
      horizontalAlignment: "Center",
      wrap: true,
      style: "heading"
    },
    {
      type: "ActionSet",
      actions: [
        {
          type: "Action.Submit",
          title: "Test Button"
        }
      ]
    }
  ],
  actions: [
    {
      type: "Action.OpenUrl",
      title: "Click to Ticket",
      url: "https://make.powerautomate.com/environments/" & Topic.TicketNumber
    }
  ]
}
See also: https://learn.microsoft.com/en-us/microsoft-copilot-studio/guidance/adaptive-cards-display-data-from-arrays