Get Approval from inside your Business Process Flow

Shows an animated gif where in the case record we call the Approval Flow inside a Business Process Flow. And that after a refresh of the form the case is updated with the information from the Approval Flow

For some time now we can call Power Automate Flows inside a Business Process Flow Stage. This is perfect for a lot of scenario’s. With this you can automate certain actions. For example we can connect to another system and update inventory. Or we can send e-mail follow-ups to other departments. Or, my favorite, we can start an Approval Flow! In this blog post I’ll share a few of my tricks.

This blog is part of a series about guiding users and teams through their work. This post is about Approval Flows inside Business Process Flows. Click here for an overview of all related post regarding Approvals inside your Business Process Flow. I also added a sample solution you can import in your own development environment so you can see the entire concept in action!

Keeping people in their flow of work by utilizing Asynchronous work or asynchronous processes is one of the key benefits for Business Process Flows. I have written down my thoughts on this subject here. Find out what asynchronous work is, how Business Process Flow can help and more advanced scenario’s.

Create the Approval Flow

Imagine a scenario where we are working an incident reported by one of our customers. They accidentally dropped their new phone which they recently bought from us and now their screen is cracked! In our system we can see that this customer is quite loyal. As the case worker we think they qualify for an immediate replacement of their screen. However it is policy that we ask for approval before we continue to do so. In this case an approval flow inside a Business Process Flow makes perfect sense!

There actually is documentation on this exact subject written by Microsoft. However this is a bit outdated. For example it shows that you need the Parse JSON action to use metadata from the Flow. which is no longer needed as their now is a special trigger available. So let’s go ahead and create our approval flow. Make sure you create the flow inside a solution else the trigger we need will not be available. The Microsoft Dataverse trigger is called: “When a flow step is run from a business process flow”.

Shows which trigger to use to get a quick start to use from inside a Business Process Flow. The trigger is called: when a flow step is run from a Business Process Flow
Create the flow with the special trigger when a flow step is run from a Business Process Flow

What I want to do in my scenario and my flow is of course Ask for an approval. But I also want to track the approval request and the progress inside the Case record. For this I added the following columns to the Case table:

  • Approver. A lookup to the User inside our environment we want to ask the approval of.
    Tip: Try to automatically (or programmatically) fill in who needs to Approve. For example based on the Case type.
  • Approval request. A text field where we store the actual request.
  • Approval requested by. A lookup to the User who makes the request.
  • Approval result. A choice field to store the status of the Approval.
  • Approver comment. A text field where we store the comment of the Approver when he accepts or rejects the Approval.
Shows the entire Power Automate Cloud flow in an overview. The trigger is expanded to show we can enter a comment. The following actions read as follows: Get userid from the user who asks approval; Update the case status and approver comment; Get email from the user who needs to give approval; Start and wait for an approval.
Overview of the flow

Get the Dataverse UserId from the Flow CallerId

To keep track on who asked for the approval for this case, I want to update the approver column. With the trigger “When a flow step is executed” we get a set of meta data of the Power Automate Flow. One of these is the “UserId”. However this is not the Dataverse UserId. This means we can not use this to fill the look-up directly. The UserId from the metadata is actually the Azure Active Directory Id of the user. Luckily this id is available to us as an column inside the User (systemuser) table inside Dataverse.

We use the Dataverse Action “List rows” and set a filter with “azureactivedirectoryobjectid eq UserId” to accomplish this. Note that I only select the columns systemuserid and fullname. It is good practice to keep the columns to a minimum as this will improve performance.

Shows the Dataverse action "List Rows" to retrieve the systemuserid and fullname from the Users table. A filter is added where "azureactivedirectoryobjectid eq 'User Id'"
Get the UserId from the one who called the flow

Now that we know who the user is who initiated the flow we can update the Case record. Thanks to another meta data attribute “BPF Flow Stage Table Row Id” we update the case.

Shows the Dataverse action "Update a row" to update the Case record from which the Approval flow is started. We fill in the Approval request with the comment, Set the Approval requested by to the first user we found in the previous List Records action and set the Approval result on waiting.
Update the Case

We fill in the Comment send in the Business Process Flow Stage at the Approval Request. We set the column Approval result to “Waiting” and fill the Approval request by Lookup with following code:


Start the Approval process!

Before we start the Approval process we need an email address. Inside the model-driven app on the form the user selects who can approve the request. After the update of the record in the action above we automatically get all the values of the record we update. We use the value of the Approver to get the User using the Dataverse action “Get row by Id”. Again we only select the column we need, in this case the internalemailaddress.

Shows the Dataverse action "get a row by id" to retrieve the internalemailadress from the Users table. The Row ID is the Value from the Approver from the previous step.
Get email address from the approver

Now we can start the approval by using the action “Start and wait for an approval”. We choose the Approval type “Approve/Reject – First to respond”. We assign the Approval to the User by the e-mail from the action above and in the Details column we add the Comment from the Approval request.

Shows the action "Start and wait for an approval" to create an Approval flow. The title is: Approval requested for BPF Definition name by the first fullname of the List Rows action. It is assigned using the email address of the user we selected in the form. The details are filled with the comment.
Start the approval

In the Title we add the name of the Business Process Flow for some context. And we add the fullname of the User who asks for Approval with the following expression:


The result of the Approval Flow so far

Now save the Flow and add it to your Business Process Flow. At the Business Process Flow designer you can add the Flow Step to your stage. You can only select the flows which use the trigger “When a flow step is run from a business process flow”.

Shows the Business Process Flow Stage where we have added the Ask for Approval Flow.
Add the Ask for Approval to the BPF Stage

Publish and activate the Business Process Flow and see it in action!

Shows an animated gif where in the case record we call the Approval Flow inside a Business Process Flow. And that after a refresh of the form the case is updated with the information from the Approval Flow
Approval Flow inside the Business Process Flow in action

I think adding an Approval flow to a BPF works great. It helps to bring someone in to take a look at the case you are working on. However this is not the final result. We of course want to capture the response of the Approval as well. Also we need to look at the “Item Link” functionality of the Approval action. It would be great if we can add a direct link to the Approval flow. As this post is already a bit lengthy, I leave that for my next post!


  1. Hello Ben,

    Thanks for sharing your knowledge! When the flow in de BPF has succesfully run, the status of the Flowstep (preview) stays on ‘Processing’. Is this a bug? I would accept that the status of the flowstep will change to Completed.

    Looking forwards to hear from you!

    Kind regards,

    Jelle de Wit (ilionx)

  2. Hi Jelle,

    You are right, I think this is a bug. I would also expect this to change to completed. And previously I’ve seen it working this way. I just created another Power Automate Cloud flow without an approval. This also stays on ‘Processing’.

    1. Thanks for your response Ben, good to hear that this was working before. I will wait for a fix!

      1. You need to add a final step in the flow. Dataverse -> Update Record -> Processing Logs -> Use the FlowsWorkflowsLogID field as the ID and update the status as “Succeeded”. The form have to be refreshed by the user to reflect this, but other than that it should work fine.

        1. You are right! This works like a charm! Today I learned 🙂
          We could even change it to “Waiting” when we are awaiting the Approval for example.

  3. Hello,

    Just curious if there is a way to prevent the case owner to update the approval status directly? Or put another way, how do we ensure it is only the approver that is setting the approval status?
    I see that the approval fields are locked in the case form/bpf, but I believe the fields are just disabled. The case owner can still update the field directly via the api.


  4. Hello Ben,

    I am a little bit curious about Data Source used in BPF. Is it possible to use SharePoint list or other Data Sources instead of table in BPF? And Can I customize the UI of the form of BPF when I run the flow?


    1. Hi Daniel,

      A Business Process Flow is always linked to a table available in Dataverse. You generally would work with a Business Process Flow inside a Model-Driven App. I think it might be possible to add a SharePoint List as a Virtual Entity and then build a Business Process Flow on top of that, but you would still work it inside a Model-Driven App anyways..
      There are some options to customize the UI of your Business Process Flow, by changing the components of the field. You can use a XrmToolBox tool called PCF2BPF to change components of fields. I have a blog about this subject here.

  5. Hi Ben,

    In our case when user is initiating the approval flow inside BPF 1st time it has been redirected to power automate portal to select country ?

    Is it correct behaviour? It is only first time if user is trying to run any flow ? Any way to avoid that to make user experience better?
    Something similar to

    Let me know if you know any rectification

Leave a Reply

Your email address will not be published. Required fields are marked *