How to hook and connect to approvals created in Teams Approvals app via Power Automate (Part 1)

Approvals application in Microsoft Teams is a great tool to create light-weight and ad hoc approval processes. What is missing, is the ability to track or hook to those approvals programmatically. Instead you can use Approvals actions in Power Automate very easily but the starting point can not be Approvals application. Recently I got a community question about catching approvals created in Approvals app by using a trigger when a new approval is created. This got me curious and thus I wanted to dig into it to see if it is possible to catch those Approval requests. As it happens: it is possible. This post will have a follow-up post later with more details.

Note: Trigger for approvals uses a Premium Connector and you may need to purchase licensing plan for Power Automate.

The reason why a licensing is required is that this happens outside of Dataverse for Teams – we are working within full Dataverse.

First – you need to set the trigger using Microsoft Dataverse – When a row is added, modified or deleted.

Then you will define what it listens (row added) and the table it should listen to.

And we can see that there is Approvals-table in there.

For the scope I chose Organization.

You can also specify if you want to filter conditions when it triggers, but in this case we want to catch ’em all.

Looking the result there are several dynamic values we want to use

I often use action / trigger raw data for debugging information – to see what is available and in what format the data is. It is very easy to copy off the raw output out of actions and see what is available.

We can test this one simply by pushing all information (we choose) to a List, for example.

When using a basic ad-hoc approval we can see the basic information in the table

The user identity is not person’s AAD GUID, but instead it looks like it is the identity used in Power Platform / Dynamics.

What we want to know now, is the name of the person who created the approval.

For that we will do “some” modifications to our Flow. We need to get the approval row from the table, so we can retrieve the name of the owner. Overall it will look like this:

First, we need to retrieve the approval with some filters (=the approval we just got triggered with)

After that I took the raw output from List rows and used it to generate the schema for Parse JSON action.

Just make sure, you use the same raw output when parsing the result.

The next step will be to set the Owner ID (I named the variable as Creator, don’t use Creator value from the output since it will be Microsoft Flow..)

And then we can finally update our List with the right name.

No, the name is not the same as Azure ID of the person – but with name we should be able to find the exact match in most cases.

Working with Approval Templates

When an Approval Template approval is used then we are missing the details information. This is because the information about details is not stored in Approvals – table, instead it is stored in the Form responses.

If we use a simple Flow to hook to that particular Forms ID we can retrieve the information that was entered to the Flow.

This way it is possible to catch all those fields people enter to the approval.

What about linking that Form answer to a specific Approval? It is possible, but again we are doing slight changes to the Flow. One reason is that the List Rows provides a different output with Approval Templates than with ad hoc approvals.

If added a sample condition with a specific template, but overall it would be better to catch that information more broadly.

If that specific template was used, then it will be Parsed with different schema but we can then retrieve the Owner Name as in the ad hoc example.

Digging deeper, we can see that we also have the Form ID available in rows returned with List Rows action!

It is a combination of values separated with @ sign. It looks like they are always of the same length so for proof of concept / testing purposes some hard coding is quick to do.

(of course when doing a pilot always use more logic: find the total length of the string and then find the location for @ sign in the string –> then hard coding isn’t going to cause issues later).

This way we can then store the info and match Forms answers with rows in Approval table – or match those later when we retrieve information. Of course there is still something missing: how we could 100% know that the exact answer is related to that specific approval item. It looks something is still hiding..

But for purposes of this blog post we have found out quite a lot of information about approvals created with Teams Approval Application!

Where this could be utilized?

What I have heard from various sources and customers, is that Approvals initiated via Approvals app are not visible to the business decision makers or company overall. Those approvals “get lost” , unless someone takes the information forward after the approval (or reject). And we don’t like to do it manually – automation is the key here. Logging approval requests and amounts may be another reason we want to use this one.

What is really cool, is that you can use Approval ID from the trigger to listen to the outcome of Approval and then automate actions based on responses. This seems to happen in default environment – at least for organization wide approvals.

There are plenty of options how to get started with this knowledge. Listening to specific approval types (specific template or with certain keywords) could enable to log only those and then integrate results to the backend system, Since we are already using Premium connector, there is a lot we could be doing.

This is not complete yet: there room for improvement and need for more information – wait for Part 2

This blog post is just the first post setting the stage here about this extended use of Flows. I will dig into this more to find out how to answers those few nagging questions:

  • Connecting Forms response to specific Approval item
  • Find out if there is a way to connect AAD identity to the user who created the approval request – this should not rely on display name only.
  • Approval templates created to a team
  • Retrieve information about approvals later on: who approved / rejected them
  • Statistics about approvals

I get back to those in following blog posts – there will be at least part 2 and possibly part 3 later on.

I created my test and demo in Proof of Concept spirit (let’s try this one out and see what is possible) it will have to be tested better in rougher environment for possible issues.

3 thoughts on “How to hook and connect to approvals created in Teams Approvals app via Power Automate (Part 1)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.