Adaptive Cards for Teams to collect data from users using Power Automate | SharePoint Lists

Adaptive Cards is something so cool and works like magic!! I’m sure there are so many creative ways to use it.

Here’s an example – Use Adaptive Cards to gather data from Microsoft Teams Users and populate it automatically to SharePoint List.

Scenario

Let’s say, you have a set of data to collect from your employees – for instance, planning a trip (or any other event for that matter) where you have to take data from employees in order to better plan the logistics.

So, in my example, I want to plan an event for which I need to ask each employee their T-Shirt size, food preference and any allergies to be taken care of.

It’s better to let the users answer at their own accord. You simply need to create a SharePoint list and list out all the Employees whom the short questionnaire should be sent to.

Adaptive Cards (https://adaptivecards.io/)

As their website says, Adaptive Cards are platform-agnostic snippets of UI, authored in JSON, that apps and services and open exchange.

It’s a superb way to make these cards pop-up in Teams, Outlook, Bot Framework etc.

In this post, we’ll ask Microsoft Teams users to submit some info which will be automatically populated to the SharePoint List.

In https://adaptivecards.io/designer/, you can design your own Adaptive Card by looking at the samples already provided on the website.

SharePoint List

Let’s say, you’ve prepared a SharePoint List called ‘Employee Preferences‘ which looks like the below. And you need to get info from them on their Allergies, Food Preference and T-Shirt size in order to prepare for the event

Power Automate

Next step, is to create a Flow in PowerAutomate to send out these Adaptive Cards to the Teams member in their Chat so that they can send back their preferences which is automatically updated in the SharePoint List.
Let’s begin –
(Before we begin, it’s up to you to decide when should the Power Automate trigger, whether on create of Each Item, or all at once when the SP List is ready. I just chose the later. So, see what’s most suitable to you.)

  1. Let’s say my first step is to get all the items from the SharePoint List I created, called ‘Employee Preferences


    And then, set the below preferences –


  2. Next, I’ll loop through each of the SP items and initiate an Teams action to send Adaptive Card and wait for the response.

  3. Now, in Adaptive Card you’ve selected for the user of the Team, I’ve used the Email field from the SP list so that I can use it in the recipient field to send the Adaptive Card to that Teams user.

    And paste the content from Adaptive Card editor in Message field.


  4. You can use dynamic data at the right places to populate you Adaptive Card wherever needed.


  5. Finally, you can have an Update message filled in. This is shown once the User Submits back the Adaptive Card with data.
    Should update card should be selected to Yes so that it doesn’t stay like that and the user knows that the response has been captured.


  6. Then, you need to update the captured response back to the SP List.



  7. At this point, your Adaptive Card is ready! Let’s test.

Adaptive Card in Microsoft Teams

Once this is run, the Teams user gets the below in the chat.

  1. User receives and Adaptive Card in their Teams Chat.

    Let’s zoom a little and see how it looks. Notice that we had populated the name dynamically in the Adaptive Card body.

  2. Now, click on Fill Out information and the card will expand to expose the form

  3. Now, I’ll fill the information as below and Submit the same

  4. Once I click Submit, I’ll see the below message. Remember, this populated from Update message field in the Adaptive card options.

  5. And when you check back the SharePoint List, the data has been updated in the same.

    And that’s it!!
    Hope this helped!

Here are some Power Automate / Flow posts you might want to look at –

  1. ChildFlowUnsupportedForInvokerConnections error while using Child Flows [SOLVED] | Power Automate
  2. BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
  3. http://flowPause a Flow using Delay and Delay Until | Power Automate
  4. Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
  5. Text Functions in a Flow | Power Automate
  6. Loop through array of objects in a Flow & Create records in CDS | Power Automate
  7. Get Count of records retrieved in CDS connector in a Flow | Power Automate
  8. Number Formatting in a Flow | Power Automate
  9. Call a Dynamics 365 Action from Flow [Bound and Unbound Actions] | Power Automate
  10. Setting Retry Policy for an HTTP request in a Flow | Power Automate
  11. Switch-Case in a Flow | Power Automate
  12. Make HTTP request from Flow in Power Automate

Thank you for your time!

6 thoughts on “Adaptive Cards for Teams to collect data from users using Power Automate | SharePoint Lists

  1. Hi,

    We have picked up that adaptive cards in an Apply to each loop waits for the previous one to be completed before that next person receives the adaptive card is this correct or are we missing something

    Like

  2. Thanks for the wonderful example. I’ve scoured the web unsuccessfully to try to determine why I don’t have the option to select the adaptive card responses like you do in step 6. I simply don’t have any Teams output available there. Any thoughts as to why that might be?

    Liked by 1 person

  3. Hello,
    In this scenario, if user 1 does not reply the adaptive card, user 2 will not get the adaptive card.
    Is there any other alternatives to overcome this situation?

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.