Business Process Flow - How to automate moving through different stages
How to automate the steps in a BPF
Quick summary: You need to grab data from 3 different tables, link them using lookup columns, capture ID’s, and add in conditions and use Data operations to shape the data into usable steps. Then add in a switch depending on your stage names, and add final actions updating your BPF table.
Sounds easy enough right?…..
I hope this helps, and I tried explaining it clearly, please let me know in case of any questions, feedback, other methods etc. For me this worked.
- Main Table
- Business process flow table (automatically created once you add a Process and save it, bring into your solution)
- Process Stages table (In Default Solution)
In Main Table; set lookup columns:
- Active Stage
In BPF table; set lookup columns:
- (GUID ID of your Main Table)
Identify process steps
- Trigger: When a row is added, modified or deleted (Dataverse)
- Added or Modified - Business process flow table
- Initialize variables for; number of stages you have
- (use a compose to check outputs if needed)
Getting the data from your tables
- Get Record
- List rows – Table: Main Table
- Row ID:
Get Process Stages (Gets active stage)
List rows – Table:Process Stages (This exists in the Default Solution)
List rows – All Process Stages (or use an Http request)
List rows – Table: Process Stages
_processid_value eq outputs('Get_process_Stages')?['body/_processid_value']
- Set an Apply to each
- Compose action: get all body from process stages
- Put a terminate – successful and run your flow, grab the output from the body of your Compose – get all body from Process Stages
- Go back into Edit
- Continue with the steps (re) move the terminate
- Parse JSON
- Schema: Click on Generate from Sample, and use the output body as grabbed in the earlier step
Create a Scope – Set variables
Append your string variables with the following code:
It checks in each apply to each, if the name matches the stagename, and then appends the ID into your string variable.
Switch for each Stage – On:
Add per stage your case
Equals – your stage name
Update a row
Your BPF Table
On the Active Process stage:
This identifies the current stage, and moves it to the next using the process ID which you specified in your variable, date now.
You can of course add in conditions, if it has the correct data, but in essence, this is how it moves (for me).
Open to any and all suggestions.