cancel
Showing results for 
Search instead for 
Did you mean: 
nagaraja2026

Update Business Process Flow stages using Power Automate

Recently, I have come across a requirement to update business process stage automatically on update of status field.

The status field is updated by external users via PowerApps Portal.

We can achieve this many ways . Writing custom code can be an option . But I thought of using Power Automate. ( Microsoft Flow is renamed to Power Automate ).

Quick note on Business Process Flow:

The method of retrieving and updating BPF fields within the record is deprecated. Read more on https://docs.microsoft.com/en-us/power-platform/important-changes-coming#legacy-process-related-attr...

 

legacy.png

 

 

 

 

 

 

The supported way is is to reference fields in the BPF entity that would have been created when your BPF was created. 

Read more on https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/model-business...

Alright, lets understand the logic before configuring flow.

Here is my logic . Status value and their corresponding stage.

image.png

 

 

 

 

 

 

 

 

 

 

 

Trigger :

The trigger is when the status is updated.

image.png

 

 

 

 

 

 

 

 

 

 

 

 

Initialize variable to store Stage Ids and Status values:

image.png

 

Retrieve Business Process Flow instance record :

List Record action is used to retrieve BPF instance record associated with work order record.

Filter query is for the purpose of returning BPF instance record associated to work order.

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Compose actions to retrieve BPF instance Id and Process Id:

 

image.png

 

 

 

 

Here are the expressions to retrieve BPF instance id and Process Id from the above List Record action.

BPF instance record id : first(body(‘Get_Work_Order_BPF_record’)?[‘value’]).businessprocessflowinstanceid

Process Id : first(body(‘Get_Work_Order_BPF_record’)?[‘value’])._processid_value

 

Get BPF Stages Ids dynamically :

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

We need to pass BPF instance record in the filter query.

 

Store BPF Stage Ids in Variables :

Apply for Each action is used to loop through the result got from above list record action and Switch Control is used to store stage ids in variables based on stage name.

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Update BPF Stage based on Status value :

Here again, Switch Control is used to update stage according to status value.

And Update record action is used to update BPF instance record with stage id.

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Traversed path :

The Traversed Path is a field as mentioned earlier that represents the life cycle of the business process flow as it contains the stage IDs the Business Process Flow as gone through. The Traversed Path field value needs to be updated to include the stage ID of the current active stage it will be moved to. This is the Review stage.To include the stage ID in the Traversed Path field the concat function is used in an expression.

For example, if BPF is moving from first stage to second stage , the expression should like below

concat(firststageid, ‘,’ ,secondstageid)

 

Conclusion :

If we follow the above steps , the total flow should like this.

image.png

Thank you for reading . Hope it helps.

Blog link : https://powerofpowerplatform.com/update-business-process-flow-stages-using-power-automate-microsoft-...

About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/