Case Management in jBPM 7

 💡 Introduction

Traditional BPMN processes are structured and predictable, defining every path in advance.
However, real-world business scenarios often need flexibility — such as handling customer complaints, legal cases, or insurance claims — where each case evolves differently.

That’s where Case Management in jBPM 7 comes in.

It enables dynamic, event-driven, and context-aware processes, giving knowledge workers the ability to make decisions during execution — not just at design time.


🧠 1️⃣ What Is Case Management?

Case Management is a knowledge-driven process where the flow isn’t strictly predefined.
It combines human decision-making with automated process fragments, allowing flexibility in execution.

Key difference from BPMN:

FeatureBPMN ProcessCase Management
Flow TypePredefinedDynamic & flexible
ControlProcess engineCase worker decisions
AdaptabilityLowHigh
ExampleOrder fulfillmentCustomer complaint resolution

🧩 2️⃣ Core Concepts in jBPM Case Management

ConceptDescription
Case FileA shared container holding data (variables) across all tasks
Case Definition (.bpmn)The model defining stages, milestones, tasks, and rules
Case InstanceA runtime instance of the case definition
Case IDA unique identifier assigned automatically to each case
MilestoneA checkpoint that represents an achieved condition or goal
Ad-Hoc TaskA task that can be triggered at any time, not bound by sequence flow

⚙️ 3️⃣ jBPM Case Management Architecture

+---------------------------------------------------------+ | jBPM Engine | |---------------------------------------------------------| | Case Definition | Case Runtime | Case Services | KIE API | +---------------------------------------------------------+ | | +--------------+ +--------------+ | Business Central | | KIE Server | | (Model & Deploy) | | (Execute) | +--------------+ +--------------+

🏗️ 4️⃣ Case Project Setup

🧾 1. Create a Case Project

In Business Central → Design → Projects → New → Case Project

Select:

  • Case Definition type

  • Name: CustomerComplaintCase

  • Package: com.sample.case


⚙️ 2. Case Definition (Case.bpmn)

Your process definition file (example: CustomerComplaintCase.bpmn) will include:

  • Start Event (optional)

  • Ad-hoc Human Tasks (e.g., Review Complaint, Request Documents, Approve Refund)

  • Milestones (e.g., Complaint Registered, Refund Processed)

  • Dynamic sub-processes

  • Case File Variables


🧩 5️⃣ Case File Variables

Case files store data used by all tasks in the case.
Example:

VariableTypePurpose
customerNameStringCustomer initiating complaint
complaintTypeStringType of complaint (billing, delivery, etc.)
refundAmountDoubleAmount to be refunded
approvalStatusStringApproved or Pending

XML Definition:

<case:caseFileItemDefinition id="cfid_1" name="customerName" structureRef="String"/> <case:caseFileItemDefinition id="cfid_2" name="refundAmount" structureRef="Double"/>

🧩 6️⃣ Ad-Hoc Tasks

Ad-hoc tasks can be triggered anytime during case execution.
For example:

TaskTypeDescription
Review ComplaintHumanReview submitted complaint
Request DocumentsHumanAsk customer for more info
Approve RefundHumanApprove or reject refund request
Close CaseHumanMark case as completed and close it

🧱 7️⃣ Milestones in a Case

Milestones represent achievements or checkpoints.
They can be auto-completed based on conditions.

Example:

MilestoneCondition
Complaint RegisteredCase variable complaintType not null
Refund ApprovedapprovalStatus == "APPROVED"

FEEL Expression Example:

approvalStatus = "APPROVED"

🖼️ 8️⃣ Customer Complaint Case Flow Diagram

Below is the visual representation of the Customer Complaint Case with its milestones and ad-hoc tasks —
created in a BPMN-style Case Management diagram using jBPM 7.

📊 It illustrates how tasks like Review Complaint, Request Documents, Approve Refund, and Close Case can be triggered dynamically, with milestones marking progress checkpoints.


















🚀 9️⃣ Starting a Case Instance (REST or Java)

Using REST API

POST /server/containers/{containerId}/cases/{caseDefId}/instances

Example:

POST /server/containers/sample_1.0.0/cases/com.sample.CustomerComplaintCase/instances

Response:

{ "case-id": "CASE-0001", "case-owner": "admin", "status": "ACTIVE" }

Using Java API

CaseService caseService = KieServices.Factory.get().getServices().get(CaseService.class); Map<String, Object> caseData = new HashMap<>(); caseData.put("customerName", "John Doe"); caseData.put("complaintType", "Billing Issue"); String caseId = caseService.startCase("sample_1.0.0", "CustomerComplaintCase", caseData); System.out.println("✅ Case started: " + caseId);

🔄 🔟 Triggering an Ad-Hoc Task

Once a case is active, you can trigger ad-hoc tasks dynamically using:

POST /server/containers/sample_1.0.0/cases/instances/{case-id}/stages/{stage-id}/ad-hoc-fragments

Or via Java:

caseService.triggerAdHocFragment(containerId, caseId, "Review Complaint", null);

🧠 11️⃣ Case Lifecycle

StateDescription
ActiveCase running
CompletedCase successfully closed
AbortedCase terminated manually
SuspendedCase paused temporarily

🧰 12️⃣ Case Management UI in Business Central

In Business Central, go to:
Menu → Manage → Cases

You can:

  • Start new cases

  • View case status

  • Trigger ad-hoc tasks

  • Add comments and case file items

  • Close or abort cases manually

📊 The UI gives real-time visibility into running case instances.


👉 Watch “Case Management in jBPM 7” in Action:

Here’s a quick demo video showing milestones, case variables, and ad-hoc task triggers in jBPM.
🎬 Coming soon on YouTube: Learn IT with Shikha

🏁 Conclusion

🎯 Case Management in jBPM 7 bridges the gap between structured BPMN automation and flexible, human-driven workflows.

It empowers organizations to handle unpredictable and evolving processes — from customer complaints to HR onboarding — with dynamic control, collaboration, and traceability.

💬 “When every case is different, jBPM Case Management helps you stay organized, compliant, and adaptive.”


💼 Professional Support Available

If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.

Technologies covered include Java, Spring Boot, PL/SQL, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).

📧 Contact: ishikhanirankari@gmail.com | info@realtechnologiesindia.com

🌐 Website: IT Trainings | Digital metal podium    

 


Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained