Blogs | Srijan

Integrating Camunda with Drupal: Why and how

Written by Ishan Mahajan | Mar 2, 2017 8:00:00 AM

In certain situations, where multiple business units and applications are involved, a combination of a Business Process Model and Notation 2.0 (BPMN 2.0) Workflow Management System and a content management system is a great fit.

In this post, we look at how Drupal was integrated with Camunda, an open source BPMN workflow engine to solve the need of an enterprise client.

And just in case you don't want to go through all the text, we have a quick video that will take you through all the steps.

When Can You Use Camunda with Drupal?

A common use case of the Drupal-Camunda integration is when Drupal is used as a BPMN web portal. How Drupal fits into the Camunda landscape:

 

BPMN is a global standard for business process modelling, in-fact it’s even taught in universities as a course. It is an essential component for a successful business-IT alignment within an organisation.

What is a BPM Portal

A BPM Portal allows you to involve more users to your workflow, specially those who are outside of the organisation. 

A portal built in Drupal allows you to:

  • Easily involve end users.

  • Easily provide BPM access to customers, vendors, partners and other users outside of the organisation.

  • Initiate the workflow processes.

  • Complete or move forward tasks.

  • Build a user dashboard and Activity/Task list.

  • Manage task assignment.

  • Provide real time information and status of ongoing processes to the workflow users.

Why Do I need the Integration?

While the core workflow users may be trained to use the default Camunda tasklist interface (the out of the box application which allows users to complete workflow tasks), not all users can be exposed to the Camunda interface.

There are other cases where your users are already on a web portal (built on Drupal in many organisations) and you would want the workflow screens integrated with the same portal.

In addition to becoming a replacement to the Camunda tasklist interface, a portal built on Drupal can provide powerful CMS capabilities to enhance the BPM portal.

  • Beyond task forms - a workflow task doesn’t have to be just a form. Rules can be configured to complete tasks on user actions such as registration, login, or even watching a video on a web page.
  • Also, several content pages can be associated with a workflow task.
  • Other powerful Drupal features such as personalization (ex modify the workflow based on user’s location or language) or content management can be leveraged for complex workflows.
  • Sending and management of notifications can be done in Drupal as well.
  • User management including registration and user groups.

How can a Drupal - Camunda Integration work?

In this integrated situation, users may interact with Drupal to complete each step of the workflow, while Drupal workflow admins may configure the tasks and actions for each step. Users can use the modular drag and drop to feature of Camunda to create a workflow and define the tasks. 

At every stage, Camunda interacts with Drupal to inform it of the next workflow step and track basic information such as the time taken to complete a workflow step. For the end user, that the Camunda is running at the backend makes no difference; they can simply check the tasks that are running in the workflow and their statuses, and respond accordingly.

The interaction between the Camunda workflow engine and Drupal is described the diagram below:

Let’s take an example of a very simple workflow process (diagram built in Camunda modeler) and see how it can be integrated with Drupal

STEP 1 : Setup task forms in Drupal

Task forms can be configured using the webforms module or it could be a Drupal content type.

We created a custom connector module that connected webform submissions with Camunda using their REST APIs.

Here is a screenshot of the basic workflow initiation step on the Drupal BPM portal.

On submission of this form, a new process instance (workflow) will be initiated in Camunda.

The first task (“Approve Request”) will be available on the BPM portal dashboard.

As a new process instance is initiated in Camunda, the state of the workflow can be viewed in Camunda’s cockpit. The cockpit will show something like this after the first step:

As you’ll note above, a unique process instance ID is associated with our workflow and an unassigned task has been created in Camunda.

In parallel, 2 nodes are also created in Drupal by our connector modules. These nodes are of content types “Camunda Request” and “Camunda Task” respectively. Along with some content fields, we store the unique camunda request and camunda task IDs in these nodes.

The Camunda Task node has the title “Approve Request” based on the workflow diagram from our example above:

STEP 2 : Build a Workflow Dashboard

Using the Drupal Views module, we build a user dashboard which allows each workflow user to see and claim eligible workflow tasks.

The task list will be unique for each user, depending on their role:

A user can claim an open task from the dashboard and take appropriate action once the task is assigned to them.

As the task is claimed, a REST API call ensures that the task assignment is reflected in the Camunda engine.

Task claimed in the BPM portal:

Task assignment reflected in Camunda:

The workflow user can use a task form to complete (“Approve Request” in our workflow example) the task:

Task Completed in Camunda and the next task initiate:

As per our example workflow, the “Approve Request” task is completed at this stage and a new task “Close Request” is created in the BPM portal and Camunda. Another node of type “Camunda Task” is created.

The newly created task can be claimed from the dashboard and the workflow can process forward.

Setup: Maximum Flexibility & Minimum Duplication

For a successful integration between Drupal and Camunda the following should be considered.

  • Ensure all process definition is stored in Camunda.

  • Let the BPM engine dictate the direction of the workflows.

  • Drupal is used to manage content related workflows tasks and to mark tasks as complete.

Here is a breakdown of what data to store in which system

Camunda Connector Drupal Module

For our clients, we created a Camunda Connector Drupal module:

The module has some of the following features:

  • Allows Drupal to connect with Camunda using REST.

  • User dashboard to claim/assign and complete tasks.

  • Configure forms and other screens for a task.

  • Configure rules (using the Rules module) for a task.

  • Sandbox URL:  https://www.drupal.org/sandbox/ishanmahajan/2821362

Why use Camunda when Drupal can handle workflows? 

Before I end, you may wonder why do we really need Camunda when Drupal has pretty powerful workflow capabilities.

Here are a few important advantages that Camunda provides as these features are available out of the box:

  • Ability to model BPMN diagrams and easily manage workflow steps

  • Process definition history & versioning

  • Process definition heatmap

  • Process instance history: user actions, audit logs with timestamps

  • Process duration report
  • REST APIs
  • BPM engine shared by multiple applications within an organisation

So give Camunda a try! If your portal runs on Drupal, we can help integrate Camunda and simplify your workflows. 

Resources

Here are a few resources to get started: