cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Muri
Regular Visitor

Providing $data property to adaptive card

Hello, 

Is there a way to provide array to $data property, or repeat items, when using power automate to post an adaptive card to teams channel? I'm using "Post your own adaptive card as the Flow bot to a channel" action with message:

 

 

{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.2",
    "body": [
        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "$data": [
                        { "name": "Matt" }, 
                        { "name": "David" }, 
                        { "name": "Thomas" }
                    ],
                    "text": "${name}"
                }
            ]
        }
    ]
}

 

 

I only get this in teams channel chat.

Muri_0-1598895711270.png

 

I expected the same behavior as in https://adaptivecards.io/designer/

Muri_0-1598900232014.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
rimatos
Community Support
Community Support

Hi @Muri ,

 

So I just tested this on my end and indeed the usage of Teams Adaptive cards with Templating is not functioning properly in Power Automate.

 

Given that this connector is in preview mode it could be that this functionality is still in developing phase.

Nevertheless, I found this video with some steps on how to achieve Templating in Power Automate: https://www.youtube.com/watch?v=dq_qGQ_3hd0 

Hope this helps!

 

Regards,

Ricardo

View solution in original post

11 REPLIES 11
rimatos
Community Support
Community Support

Hi @Muri ,

 

Can you confirm if the expression you pasted is correct? I just tried to test it in the https://adaptivecards.io/designer/ and I get the same output as you do through Flow.

 

rimatos_0-1599032875501.png

 

Regards,

Ricardo

Hi @rimatos ,

 

Posted code should work. Yes, it will appear as a template at first. If you click on the "Preview mode" button at the ribbon, it should display the desired output.

Muri_0-1599034640878.png

 

I am now trying to figure out how this works when used with the power automate and teams activities. How to get it previewed there?

rimatos
Community Support
Community Support

Hi @Muri ,

 

So I just tested this on my end and indeed the usage of Teams Adaptive cards with Templating is not functioning properly in Power Automate.

 

Given that this connector is in preview mode it could be that this functionality is still in developing phase.

Nevertheless, I found this video with some steps on how to achieve Templating in Power Automate: https://www.youtube.com/watch?v=dq_qGQ_3hd0 

Hope this helps!

 

Regards,

Ricardo

@rimatos Thank you for your time and help. Yes, in the video they say that it is not supported by the Teams now, but they plan to support it in the future. I needed that for now. I don't know why it was hard for me to find that information in the first place.

 

Thanks again,

Muris

Can someone confirm that $data binding in power automate is not possible? I can't find any doc about this. It feels like the Adaptive Cards in Power Automate is a different story. Some functions aren't the same either.

https://docs.microsoft.com/en-us/adaptive-cards/templating/language#repeating-items-in-an-array

 

I've been struggling with this for days. My card design works perfectly in the adaptive cards designer/preview with data binding. I just can't figure out how to make the card work in Power Automate. It's dumb to manually write inline data instead of using an array to populate every section. If that's the only solution, then what's the point of  "automate"?

virakones
Responsive Resident
Responsive Resident

@cherwan Hello

 

Have you had any luck?

 

I have a Parse JSON action in my flow that collects some data in an array. From there I would like to bind this data to $data of an Adaptive Card so that elements can repeat.  

skandadai
Regular Visitor

This is certainly a important feature that Microsoft is missing for Teams. Also for Teams even with turning on experimental feature, this option is not visible. Looks like they removed it completed.

NielsL
Helper V
Helper V

The only working solution I have found for repeating items, is to create a string variable, and append that in Power Automate for each item.

 

E.g. Here I am adding an input toggle to the adaptive card for each row from a previous list rows action:

 

NielsL_1-1618384610401.png

 

I then add the variable to the message of the adaptive card, which repeats the toggles:

NielsL_2-1618384780059.png

 

This works fine when the adaptive card is posted to the user:

 

NielsL_3-1618384910297.png

 

However, the issue with this solution is that the output from the adaptive card is pretty useless and I can't really do anything with that afterwards in Power Automate. E.g. I would like to use an 'Apply to each' action for each of the items but that is not possible with the current output.

 

NielsL_4-1618385116119.png

aksridhar1
Advocate II
Advocate II

Thanks @NielsL . I ended up doing what you mentioned. Concatenating the individual items ibn Power Automate and passing that. But that kind breaks the advantage of password the data dynamically. But the solution works and my use case is simple. So I am good for now. Thanks again.

Yes, it is  not an optimal solution but it can be used for simple use cases. Let's hope that there are some more features added once it gets out of preview. 

virakones
Responsive Resident
Responsive Resident

@NielsL 

Hi there, I had a similar question on how to get some use from the output of the adaptive card dynamically generated responses, where each input had a unique Id.

This was a creative solution using a series of "Apply to Each" actions from v-yiwenxie-msft: Solved: Re: How to Select value from Object using value fr... - Power Platform Community (microsoft....

From there I was able to get those Id values and write back the responses to a dataverse record. I was able to get more control from the more sophisticated adaptive card templates through Teams.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (4,320)