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.
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.
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.
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
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.)
- 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 –
- Next, I’ll loop through each of the SP items and initiate an Teams action to send Adaptive Card and wait for the response.
- 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.
- You can use dynamic data at the right places to populate you Adaptive Card wherever needed.
- 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.
- Then, you need to update the captured response back to the SP List.
- 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.
- 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.
- Now, click on Fill Out information and the card will expand to expose the form
- Now, I’ll fill the information as below and Submit the same
- Once I click Submit, I’ll see the below message. Remember, this populated from Update message field in the Adaptive card options.
- 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 –
- ChildFlowUnsupportedForInvokerConnections error while using Child Flows [SOLVED] | Power Automate
- BPF Flow Step as a Trigger in CDS (Current Environment) connector | Power Automate
- http://flowPause a Flow using Delay and Delay Until | Power Automate
- Generate Dynamics 365 record link in a Flow using CDS connector | Power Automate
- Text Functions in a Flow | Power Automate
- Loop through array of objects in a Flow & Create records in CDS | Power Automate
- Get Count of records retrieved in CDS connector in a Flow | Power Automate
- Number Formatting in a Flow | Power Automate
- Call a Dynamics 365 Action from Flow [Bound and Unbound Actions] | Power Automate
- Setting Retry Policy for an HTTP request in a Flow | Power Automate
- Switch-Case in a Flow | Power Automate
- Make HTTP request from Flow in Power Automate
Thank you for your time!