Many organizations need to to approve data in their system. One example is the procurement of products required for sales and operations from various vendors. Usually not all the members of the organization have permission to go and order such products and there will be a hierarchy of approvals.

In this post we are going to discuss about approval process of a Purchase order from Business Process Flow. In many cases a business requires approval of a process from different members or teams depending on the type of approval or the reporting team.

In this Scenario we are considering a Purchase Order approval depending on the Order value in Dollars.

Create and Set the Approving Team
Let us consider Sales Team Members can approve purchase orders below 500$ and Sales Team Leaders can approve purchase orders up to 2000$ and above that it need to be approved by Sales Manager.

Create the above Teams add the members required to the respective teams.

On the purchase order form, we need to create a field “Approval Team.”

This field should be auto populated depending on the value of the Purchase Order. We need to create a business rule to set the field value as below.

IF
Total Amount less than or equal 500
THEN
Set Approving Team to “Sales Team Member”
ELSE IF
Total Amount less than or equal 2000
THEN
Set Approving Team to “Sales Team Lead”
ELSE
Set Approving Team to “Sales Manager”

Check if Approving User is in Team
To check if the user is a member of the team we use a simple process, but we need some custom workflow activities. We must import the Dynamics 365 Workflow tools Solution in the environment we are trying to create the approval process. The solution can be downloaded from GitHub link below.

Releases · demianrasko/Dynamics-365-Workflow-Tools · GitHub

Once the Approving team is set and Workflow tools solution is imported, we can create an on demand workflow to validate the Purchase Order Approval.

Create a new real time workflow on the Purchase Order Table and set it as on demand.

Add step Is user in Team

Then set Properties as shown below
Then set Properties as shown below
Then add another step if the user is part of team, then stop the process with an error as below
Putting it all together

Once the Business Rule and Workflow are set, we need to add them to the Approval stage in the Business Process Flow.

Open the BPF and click on the Approval Stage in the editor on the right pane you can view the option to add a Business Rule to this stage option from where we can add the business rule.

Select the Approval stage and add a data step and add the Approving team field to the Approval stage, then click on add again and select workflow and add the workflow we created to the Approval stage, set the trigger of the workflow to the stage exit.

Once all this is done the Approval process should work as expected. Only the members of the teams specified in the approving team will be able to approve the purchase order and move to the next stage. If the Approving user is not part of the team, it throws an error as below.

We can also set up notifications for the approval teams using Power Automate Flow or Workflow depending on your organizational need.