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:
Stay tuned for part 7, where we most definitely will have a look at what happens when the request is approved 🙂
About the Author:
Sandtorv, M. (2019). Take control of your Microsoft Teams environment part 6. Available at: https://teams.rocks/2019/08/01/take-control-of-your-teams-environment-part-6/ [Accessed: 6th February 2020].
Sandtorv, M. (2019). Take control of your Microsoft Teams environment part 6. Available at: https://teams.rocks/2019/06/04/take-control-of-your-microsoft-teams-environment-part-2/ [Accessed: 6th February 2020].