Camunda 7 Form Submit Error – Expression Returns Non-Boolean (Root Cause & Fix)

 In Camunda 7, form submissions often fail with a confusing runtime error:

Cannot submit task form
Condition expression returns non-Boolean: result has class java.lang.String and not java.lang.Boolean

This issue is very common when using embedded forms, task forms, gateways, or conditional flows.
This blog explains why it happens, how to identify the root cause, and how to fix it correctly.


1️⃣ What This Error Actually Means

Camunda expects Boolean (true / false) values in:

  • Sequence flow conditions

  • Gateway conditions

  • Conditional events

  • Form field validations (indirectly)

But instead, the expression is returning:

  • A String ("true", "false", "yes", "no")

  • Or a non-Boolean object (e.g. Integer, Long, null)

➡️ Result: Form submission fails


2️⃣ Most Common Root Causes

🔴 Root Cause 1: Form Field Type Is String (Not Boolean)

In Camunda forms, values are Strings by default.

Example:

<input type="radio" cam-variable-name="approved" value="true">

This stores:

approved = "true" // String, not Boolean

Later used in BPMN:

${approved}

❌ Fails because it returns a String

Fix:

${approved == 'true'}

🔴 Root Cause 2: Gateway Condition Uses Variable Directly

❌ Incorrect:

${approved}

If approved is "true" (String), Camunda throws the error.

✅ Correct:

${approved == true}

or (String-safe):

${approved == 'true'}

🔴 Root Cause 3: FEEL / JUEL Expression Confusion

Camunda 7 uses JUEL, not FEEL.

❌ Invalid (FEEL-style):

approved = true

✅ Valid (JUEL):

${approved == true}

🔴 Root Cause 4: Radio Button / Select Returns String

HTML forms always submit String values.

Example:

<select cam-variable-name="decision"> <option value="yes">Yes</option> <option value="no">No</option> </select>

Later used as:

${decision}

❌ Error: String is not Boolean

✅ Fix:

${decision == 'yes'}

🔴 Root Cause 5: Variable Is Null

If the variable is not set, the expression returns null.

❌:

${approved}

✅ Null-safe check:

${approved != null && approved == true}

or

${approved == 'true'}

3️⃣ How to Identify the Problem Quickly

✔ Step 1: Check Variable Type in Cockpit

  • Open Cockpit → Variables

  • Check Type (String / Boolean)

✔ Step 2: Check Form Field Definition

  • Embedded form

  • Generated form

  • External form (Angular / React)

✔ Step 3: Inspect Gateway Condition

Look for:

${variableName}

This is almost always the issue.


4️⃣ Best Practice Patterns (Recommended)

✅ Pattern 1: Always Compare Explicitly

${approved == 'true'}

✅ Pattern 2: Convert in Java Delegate

Boolean approvedBool = Boolean.valueOf((String) approved);

✅ Pattern 3: Use Boolean Form Field

If using Camunda generated forms:

"type": "boolean"

5️⃣ Example: Correct BPMN Gateway Condition

❌ Wrong:

${formDecision}

✅ Correct:

${formDecision == 'approve'}

or

${formDecision == true}

6️⃣ Production Checklist

✅ Never rely on implicit Boolean evaluation
✅ Always compare String values explicitly
✅ Validate variable types in Cockpit
✅ Avoid FEEL syntax in Camunda 7
✅ Add logging before gateways if needed


7️⃣ When to Ask for Expert Help

If:

  • The error occurs only in production

  • Forms are external (Angular / React)

  • Multiple gateways depend on the same variable

Professional debugging can save hours.


💼 Professional Support Available

If you are facing issues in real production projects related to Camunda forms, task submission errors, gateway conditions, or expression failures, I provide paid consulting, production debugging, project support, and focused trainings.

📧 Contactishikhanirankari@gmail.com | info@realtechnologiesindia.com

🌐 WebsiteIT 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