Deep Dive: How the LFS Workflow Dynamic Roles Mechanism Works

In most BPM systems, the concept of a 'role' is static. You create a 'Chief Accountant' role and rigidly assign specific employees to it. But what if the performer of the next step is unknown at the process design stage? What if they need to be determined on the fly, based on the data in the request itself? This is precisely why a powerful dynamic roles mechanism exists in LFS Workflow.
The Problem: Approval by an 'Unknown' Manager
Consider a classic process: 'Vacation Request'. An employee creates a request, and it must be approved by their direct manager. In a company with 500 employees and dozens of departments, it's impossible to create 500 separate routes. You need a system that understands who the manager is for Ivan Petrenko from the IT department, and who it is for Anna Kovalenko from the sales department.
How It's Implemented in LFS Workflow
Our architecture solves this task elegantly by combining data from XML with logic at the process edge level.
- Context Saving in XML: When Ivan creates a request, his unique ID is saved in the process instance's XML, for example,
<employee_id>123</employee_id>
. - Logic on the Edge: On the edge leading to the 'Manager Approval' step, we don't specify a static role. Instead, we use a special module or a PHP snippet.
- Dynamic Query: At the moment of transition, this module takes the
employee_id
from the XML and makes a query to your HR system or Active Directory: 'Return the manager's ID for the employee with ID=123'. - Assigning the Performer: The system receives a response, for example, ID=456 (Anna Kovalenko's ID), and dynamically assigns her as the performer for the next step.
Thus, we have a single process that works correctly for the entire company, no matter how complex its organizational structure is.
More Than Just Roles
This mechanism allows for the implementation of extremely complex scenarios:
- Routing by Amount: If the invoice amount is less than $1,000, the performer is the department head; if more, it's the CFO.
- Territorial Routing: A request from the Lviv branch is automatically routed to the Western region's manager.
- Concurrent Execution: A task can be assigned to a whole group of lawyers, and the one who takes it first becomes the performer.
It is this flexibility at the core level that distinguishes LFS Workflow from many 'off-the-shelf' solutions and allows you to build processes that perfectly match the realities of your business.
Turn Theory into Practice
Learn how LFS Workflow can solve your specific business challenges. Request a free demo and get a personal consultation.
Request a Demo