Microsoft recently released a personal app for Approvals
within Teams. Please review this before investing time implementing something
customized. If you are still interested in creating a custom adaptive card for
an approval process check out the following blog for which this blog is a good
precursor.
With Microsoft Teams becoming an increasingly dominant force in collaboration, and one objective being the reduction of email, this blog covers how you can simply replace approval email notifications with dynamic adaptive cards in Teams.
So, how does it work?
I have created a sample SharePoint list using the “Travel
requests” template and associated it with my Team as shown below.
Within Microsoft Power Automate I have created an “Automated cloud flow” using the “When an item is created” trigger.
The next step is to add the “Create an approval” action. I have personally configured this action as follows.
Notice how I have set the “Enable notifications” to “No”. This will disable email notifications. Within the “Details” section I have defined an additional break between each line, otherwise everything will appear on one line within the adaptive card.
As this is a demo, I am using the “Created By Email”
as the approver. If this were a real-world scenario you could dynamically
retrieve the approver by using a flow action such as “Get manager”.
The next step is to drop in the “Post your own adaptive
card as the Flow bot to a user (preview)” action and configure.
The “Recipient” property should be the same as the
approver defined above.
The “Message” property should be set as “Teams
Adaptive Card.”
With regards to the “Headline” property, I am not
quite sure where this is used. As shown below the adaptive card takes the approval
title as the headline, not the “Headline” property I explicitly set
above.
The “Summary” will appear in the toast that is
displayed to the approver.
The “IsAlert” property defines whether you would like
the request to appear in the approver’s activity feed within Teams.
Finally add the “Wait for an approval” action and
insert the Approval ID from the “Create an approval” action as shown
below.
The whole flow so far should look like the following.
Optionally we can now add in a condition to check whether the travel request was approved and set the SharePoint list value accordingly.
We have now created the building blocks to replace Power Automate Approval Emails with Adaptive Cards in Teams. Of course, this could be enhanced further by updating the conditions to inform the initiator when travel requests have been approved, which can also be accomplished via adaptive cards.
Let us see it in action
- Approver receives the request.
- Clicks the “Approve” button and inputs some comments.
- Once happy clicks the “Submit” button.
- The adaptive card dynamically updates to reflect the response.
- Let us check the “Travel requests” in Microsoft Teams.
- Fantastic! We can see the request has been approved.
Although this is a rather simple change, I think it is great that we can now not only submit requests via Teams, but we can also approve them without having to review email.
Comments
Post a Comment