Use Adaptive Cards to Update Microsoft Lists from Teams using Power Automate

In this blog post I will show how to update a Choice column in Microsoft Lists using a Microsoft Teams Adaptive Card and Power Automate. If you are following along please be sure to build the List and Flow as described in: Send reminders to Teams from Microsoft Lists using Power Automate and Send an Adaptive Card to Teams from Microsoft Lists using Power Automate.

Our current Adaptive Card provides a reminder message and a link to the List item as shown in the image below.

Version 1 of our Adaptive Card

Our next evolution of the Adaptive Card will include the option to set the Status column to a value specified by the user through a drop-down menu embedded in the Card.

Version 2  of our Adaptive Card

Let’s start by updating our current Adaptive Card using the https://adaptivecards.io/designer site. Paste the existing payload into the Card Payload Editor and set the Host app to “Microsoft Teams – Light”.

https://adaptivecards.io/designer/

Add a “Input.ChoiceSet” to the card by dragging Input.ChoiceSet to the card canvas.

Input.ChoiceSet

Set the “Input.ChoiceSet” element properties as follows:

  • Id to “UserChoice” – we will evaluate this value later in our Flow
  • Placeholder to “Status value”
  • Choices to “Blocked”, “In progress”, “Completed”, “Duplicate”, “By design” and “Won’t fix”. These correspond to the Choice values in the Issue Tracker Status column.
"Input.ChoiceSet" element properties

Add a “Action.Submit” action to the card by clicking Add an action.

Action.Submit

Set the “Action.Submit” element properties as follows:

  • Title to “Update”
  • Data to “{“UserAction”:”Updated”}”
"Action.Submit" element properties

Click “Copy card payload”.

Copy card payload

Edit your existing Flow in Power Automate – mine is called Issue tracker – Daily (Teams) – and add a new Post an Adaptive Card to a Teams user and wait for a response action and set:

  • Recipient to “Person or group the issue is assigned to Email”
  • Paste in the copied card payload to Adaptive Card
Post an Adaptive Card to a Teams user and wait for a response - Reminder action

If your List and Flow structure does not match mine be sure to update it to meet your needs. Use the card payload listed below to find the areas that might need to be updated (highlighted in red).

{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"speak": "Issue tracker reminder",
"body": [
{
"type": "TextBlock",
"text": "Issue tracker reminder:",
"isSubtle": true
},
{
"type": "TextBlock",
"text": "@{items('Apply_to_each_-Reminder')?['Title']}", "size": "Large", "weight": "Bolder" }, { "type": "TextBlock", "text": "Due in @{variables('varNumDays')} days.", "isSubtle": true }, { "type": "TextBlock", "text": "@{items('Apply_to_each-Reminder')?['Description']}", "isSubtle": true }, { "type": "Input.ChoiceSet", "choices": [ { "title": "Blocked", "value": "Blocked" }, { "title": "In progress", "value": "In progress" }, { "title": "Completed", "value": "Completed" }, { "title": "Duplicate", "value": "Duplicate" }, { "title": "By design", "value": "By design" }, { "title": "Won't fix", "value": "Won't fix" } ], "placeholder": "Status value", "id": "UserChoice" } ], "actions": [ { "type": "Action.Submit", "title": "Update", "data": { "UserAction": "Updated" } }, { "type": "Action.OpenUrl", "title": "More info", "url": "@{items('Apply_to_each-_Reminder')?['{Link}']}"
}
],
"-ms-tokens": {}
}

Add a new Switch action and set On to “userChoice”.

Set Switch to UserChoicce

Note: It would seem that, at the time of writing, there is an issue with the Post an Adaptive Card to a Teams user and wait for a response action where the Dynamic content is no longer available after you have saved and run your Flow. In that event you should be able to copy the existing value (“body/data/use…”) for subsequent use in your Flow if required. See example below.

Switch action

@{outputs('Post_an_Adaptive_Card_to_a_Teams_user_and_wait_for_a_response_-_Reminder')?['body/data/userChoice']}

It is important to understand that in the above code, ‘Post_an_Adaptive_Card_to_a_Teams_user_and_wait_for_a_response_-_Reminder’ is the action name where spaces have been replaced with underscores. Updated this as required to match your Flow.

Add a new Case section for each value in the “Input.ChoiceSet” (“Blocked”, “In progress”, “Completed”, “Duplicate”, “By design” and “Won’t fix”). Configure as follows:

  • Set Equals to “Blocked”.
  • Add a new SharePoint Update item and set:
    • Site and List to your target site URL and List name
    • Id to “ID” from the Get items – Issue tracker action.
    • Title to “Title” from the Get items – Issue tracker action.
    • Status value to “Blocked”
Case section

Be sure to repeat for each “Input.ChoiceSet” (“Blocked”, “In progress”, “Completed”, “Duplicate”, “By design” and “Won’t fix”) value.

My completed Flow looks like the image below.

My completed Flow.

Save and test your Flow. Assuming you have an issue due in 30 days you will get the following adaptive card in Teams from Flow Bot:

adaptive card

At this point the Flow will simply wait for the a response from the user.

Flow is waiting

Once the response is received the Switch statement will evaluate the response and then update the List.

Updated list

The Adaptive Card experience is a fantastic way of bringing actionable information to your users. Get started with your own Adaptive Cards using the examples available on the adaptivecards.io site.

Microsoft Teams based Adaptive Cards powered by Microsoft Lists and Power Automate are better together and make for an awesome solution platform for your users.

Thanks for reading!

NY

2 thoughts on “Use Adaptive Cards to Update Microsoft Lists from Teams using Power Automate

Leave a comment