Workflows

How Can I Add Workflows to My App?

Workflows are natively part of the logic capabilities of Mendix.

The visual workflow editor in Mendix Studio Pro allows you to build extendable processes in a format that closely follows BPMN concepts. Workflow logic is fully integrated with other visual languages, such as microflows and pages.

Developers building workflows have full control over the workflow data, since the same domain model than underpins the entire app is the foundation for the workflow definition. This means you can build workflows data-first.

Workflows are executed in the Mendix Runtime, which is able to run long-lived processes. You do not need to include an external workflow engine or deploy your workflows and their orchestration separate from the main application.

Who Can Build Workflows?

Both trained developers and tech-savvy business users can capture processes into workflows.

Developers can use the full power of Mendix Studio Pro to model the ins and outs of any process in the highest level of detail, apply advanced logic, integrate with any system, and create reusable workflow artifacts.

With Mendix, the process definition becomes part of the app. This increases maintainability. It also means that developers can work with different apps easier, as it becomes easy to understand the overarching logic in each app. This reduces the cost and time involved to switch contexts considerably.

Moreover, since the process is defined explicitly and visually, you can leverage the review capabilities of the Mendix Platform to involve business-minded users in the development process of advanced workflow logic, which significantly shortens the feedback loop.

How Can I Trigger a Workflow?

Workflows can be triggered from buttons and from microflows. Since microflows can be exposed and called via REST, this means workflows can also be called remotely.

Think of a workflow as process orchestration across multiple user tasks (that show pages to users executing a task) and microflow tasks (that the workflow runs when the microflow is configured as a system task). In the workflow domain, microflows can also be used to kick-off a workflow, or to complete a user task, e.g. when advanced validation is required.

On-click action to call a workflow

Which Workflow Actions Are Available?

In essence, workflows consist of user tasks (human tasks) and system tasks.
  • User tasks require user interaction: end users will see pages that contain the information they need to complete the task. These pages are regular Mendix pages that can be edited in the page editor of Studio Pro, hence have the full configuration flexibility of any page in Mendix.
  • System tasks call a microflow. They do not require user interaction.
  • Other workflow elements include the following:
  • Gateways to split the flow in multiple branches, allowing you to split the flow in several paths using exclusive behavior (decision) or parallel behavior (parallel split). The decision action makes a decision based on a condition and follows one and only one of the outgoing paths. The parallel split adds two or more parallel paths to your workflow.
  • A Jump element which allows you to proceed directly to one of the workflow steps on the workflow path. For instance, you can jump back in the process to redo the tasks on the path again or skip a number of downstream tasks.
  • A start activity and one or more end activities. 
  • Reusable elements that developers can add to the workflow editor toolbox themselves, by exposing microflows as workflow actions.

For more information, see the How can I reuse workflow logic and content section below.

How Can a Process Administrator Handle In-Flight Processes?

Long-lived business processes imply the need for functional process management. For example, assigned users are on leave, process definitions change or certain process instances are run out-of-process as an exception.

Developers can use a range of actions in pages and microflows to enable process administrators to manage workflow instances effectively.

Mendix gives the developer full control to build process management capabilities. To speed things up, Mendix comes with a fully functional Workflow Commons module that contains pre-configured process management screens, dashboards, and a generic inbox screen. All of these are customizable and can be replaced by a module of your choice. This allows for company branding of pages and implementing other company-specific process requirements.

How Do Changes in the Workflow Definition Affect Running Processes?

Longlived business processes imply the need for migration in case of workflow changes. The default behavior in the runtime is that running instances will be upgraded to the new workflow definition, or marked as ‘conflicting’ if auto-upgrading is not possible. The process administrator role then needs to deal with those. A developer can clone a workflow, effectively creating a new version, if it is desired to keep running instances following the old definition. 
For more information, see Updating Your Workflow Definition in the Mendix Studio Pro Guide.

How Do I Assign Tasks to Potential Users?

User tasks need to be targeted at users, meaning the potential set of users that could pick up the task. Developers have complete control over modeling this group of users by using XPath or by implementing more flexible and advanced logic using a microflow per user task.

Moreover, each user task provides the OnCreated property that enables the developer to implement delegation policies using microflows. Escalation can also be modeled, using existing Mendix constructs.

User Assignment Example

How Can I Configure Workflow Security?

Security is handled using the existing Mendix security model. For instance, only specified roles can start a workflow, can see it in the task inbox, have access to the underlying data and can complete the task using one of the task outcomes. This provides the developer with the granularity to effectively model workflow security. For more information, see Security Model.

How Can I Reuse Workflow Logic and Content?

Mendix gives the developer full control to build reusable workflow artefacts. For initial speed, Mendix comes with a fully-functional Workflow Commons module that contains preconfigured process management screens, dashboards, and a generic inbox screen. Workflow Commons also contains other preconfigured documents, such as snippets, page templates, and microflows.

Installing this module is not required for workflow capabilities to be enabled.  However, it does simplify a developer’s work so that they can benefit from out-of-box functionality. All of the content is customizable and can be replaced by a module or implementation of your choice.

Moreover, developers can add reusable elements to the workflow editor toolbox by exposing microflows as workflow actions. These can also be imported via modules containing exposed microflows from the Marketplace and other repositories.

In this way, company best practices can be shared with anyone in the company wanting to build workflows, both businessminded users as well as other professional developers on the team.

How Can I Get Visibility of All Workflows in My Enterprise?

In every Mendix app, each workflow stores its execution data in a standard, publicly accessible format that is part of the System module. This means, that developers can extract the data into a central repository or reporting service (such as Business Intelligence tooling) to get an enterprise view on workflows in the company, for both active and completed workflow instances.