Condition expression returns non-Boolean: Result has class java.lang.String and not java.lang.Boolean

I am receiving the following error “Condition expression returns non-Boolean: Result has class java.lang.String and not java.lang.Boolean” when I’m trying to run the following script;

const { Client, logger } = require(“camunda-external-task-client-js”);
const { Variables } = require(“camunda-external-task-client-js”);

// configuration for the Client:
// - ‘baseUrl’: url to the Workflow Engine
// - ‘logger’: utility to automatically log important events
const config = { baseUrl: “http://localhost:8080/engine-rest”, use: logger };

// create a Client instance with custom configuration
const client = new Client(config);

// susbscribe to the topic: ‘creditScoreChecker’
client.subscribe(“DecideOnExpansion”, async function({ task, taskService }) {
// Put your business logic

var north = Math.random() >= 0.5;	
const variables = new Variables();
variables.set("north", north);	

// complete the task
await taskService.complete(task, variables); //error happens at this line of code
});

Enclosed is the error I receive from Nodejs.

1 Like

Can you upload your model?

Thanks Niall for responding. Enclosed is the Camunda Model that I was using.Demo3.bpmn (7.0 KB)

Hi,

So it’s just that your expressions are incorrect. You need to change
#(not north) -> #{not north}
and
#(north) -> #{north}

That should solve the problem

Hello Niall,

Thanks for your help. Updated to the curly brackets and everything worked. Thanks again!

Regards,
Kevin

1 Like