Managing Business Process Flow Stages with Traversed Path Variable
In today's dynamic business environment, organizations strive to optimize their operations by streamlining business processes. These processes often involve multiple stages, each requiring specific actions and inputs. One of the best ways to handle these processes in a Model-Driven app is Business Process Flows. I struggled mightily with this when working on a use case surrounding our Purchase Order application we are making. This article will provide makers a way to utilize the traversed path variables, and easier move the stage based on approvals.
In our specific use case, we have implemented a streamlined three-stage approval process. Let us delve into each stage to understand the process flow more comprehensively:
Stage 1: Data Population
During the initial stage, the user assumes responsibility for populating the necessary data. This crucial step ensures that all required information is accurately entered, laying the foundation for subsequent stages.
Stage 2: Pending Approval
Once the data is populated, the user advances the business process flow to the pending approval stage. At this point, the system carefully examines the provided information, validating its completeness and integrity. This step is crucial for maintaining data quality and ensuring that the subsequent stages are initiated with accurate and reliable data.
Stage 3: Creation of New Record with Restricted Access
Upon successful approval, the process advances to the creation of a new record in dedicated tables. This new record is meticulously generated, considering the approved data. To maintain data security, the core users are granted read-only access to these tables, safeguarding the integrity of the information. However, authorized power users, designated by their security role, are granted editing privileges, enabling them to make necessary updates or modifications as required. By aligning the final stage with a different table, it also locks the third stage in the business process flow, limiting the potential human error of user pushing it to the incorrect stage.
Starting the Power Automate automation.
The first step is to create a Dataverse step for when a row is added, modified or deleted. Set the change type to modified. For table name get the table that is associated with your business process flow. If you did not know when you created a business process flow a table is created with the same name. For this example, let us call it Purchase Order Approval Process. We set our scope as Organization.
Recommended by LinkedIn
Immediately following the trigger, I would create a compose action to and populate it with the dynamics content of Active Stage (Value), test your automation by getting the active stage ID for each of your respective stages. I would recommend the Initialize Variable action for each of your stages populating the active stage ID for each variable value.
In addition to variables, we will want to have a variable for Traversed Path, this value can be found under dynamics content from your trigger action. Traversed path variables are a means of capturing and storing information about the path taken within a business process flow. As a process progresses through various stages, a traversed path variable dynamically tracks the sequence of stages visited, creating a comprehensive record of the process's journey. This variable can be stored and accessed throughout the process lifecycle, enabling real-time monitoring, analysis, and optimization.
The approval process.
In our example I am not going to go into detail about setting up approvals. At a high level, you need an approval action and set a condition based on the approval's outcome variable. In our example, let us focus on rejection. If an approval is rejected, we want to move the business process backward and out of pending approval. Assuming all changes that need to be made will be communicated to the record owner.
Once rejected we will want to add an action to update a row. The table will be our Purchase Order Approval Process. We will need to populate Row ID with the Purchase Order Approval Process this value comes from our trigger. This took me far too long to work out but, we will only be updating the traversed path column. We will need to create a concat() expression. Within the expression we want to capture our traversed path variable. Then add a comma ‘,’ followed up by the desired Active Stage variable.
concat(variables('Traversed Path'),',',variables('Create Purchase Order Request'))
This will change move the business process flow back to the first stage of Create Purchase Order Request when rejected.
Conclusion
Updating business process flow stages with traversed path variables presents numerous advantages to organizations seeking to optimize their operations. Improved visibility, real-time monitoring, adaptability, error handling, and compliance are just a few of the benefits offered by incorporating traversed path variables into business processes. By leveraging this powerful tool, businesses can streamline their operations, enhance productivity, and gain a competitive edge in today's rapidly evolving marketplace.
Great work Sean!