Last time we added an approval flow, where managers could accept or decline the request for a new team. But that was based on email, which seems a bit old fashioned, right? What if we could to all this in Teams? Let’s give it a try!
OK, I know I promised you last time that it was time to cover what happens when a request was approved. Please bear with me, I’ll cover that in the next part for sure.
First, we’ll need to replace the Start an approval action, with an action called Create an approval.
We’ll set the Approval type to Approve/Reject – First to respond, add a title and assign the approval to the user’s manager by picking the Mail object from Get manager (V2).
Requestor is set to the user, by specifying the Mail object from Get user profile (V2). Finally we disable email notifications by setting Enable notifications to No.
Next we’ll pull the adaptive card from the above action, into a new action called Post your own adaptive card as the Flow bot to a user (Preview).
The recipient needs to be the manager, so we’ll pull the Mail object from the Get manager (V2) action (above). The Message needs to be the Adaptive Card created by the Create an approval action.
We also need to catch the response, which we’ll do with an action called Wait for an approval, where we specify the Approval ID.
In the Condition we’ll need to change from Response to Outcome.
And we’ll need to update the If yes and If no to post a message in Teams instead of sending an email.
Note that the Mail object is from Get user profile (V2) and the Display Name in the message is from Get manager (V2).
Finally, before we move on to the team creation logic in the next part, we’ll also want to post a message into an approval channel where everyone can see what teams have been approved.
For these things to work you’ll need to add the flow bot to your team.
We’ll accomplish that using an action called Post a message as the Flow bot to a channel (Preview).
We’ll select the appropriate team and channel, then pull the title of the team as well as the requestor from the SharePoint list, and finally add the Display Name from the Get manager (V2) action.
This is what it looks like with the latest changes:
For a full video tutorial on how to add approvals in Teams using adaptive cards, please visit Jonathon Levesque and Daniel Laskewitz‘ video on the subject at the Microsoft Flow blog (source).
Stay tuned for part 7, where we most definitely will have a look at what happens when the request is approved 🙂
Pingback: Take control of your Microsoft Teams environment part 5 | Teams.rocks
Pingback: Take control of your Microsoft Teams environment part 7 | Teams.rocks
Great series, Magnus!
Is it possible to add more info to the adaptive cards that are posted in Teams? I would like to add infomration regarding the Team name and description for the approver as I feel this is important info. This information is added to the Adaptive card that is sent to the requester after an approval…
Nvermind, I figured it out. Just by adding more info to the Details field 🙂