bpmn-engine icon indicating copy to clipboard operation
bpmn-engine copied to clipboard

How to support some more complex expressions in completionCondition?

Open eyes4 opened this issue 9 months ago • 7 comments

Here's one of my bpmn snippets and it works just fine:

<bpmn2:multiInstanceLoopCharacteristics` camunda:collection="${environment.variables.handlers}" camunda:elementVariable="handler">
        <bpmn2:loopCardinality xsi:type="bpmn2:tFormalExpression">${environment.variables.handlers.length}</bpmn2:loopCardinality>
        <bpmn2:completionCondition xsi:type="bpmn2:tFormalExpression">${content.output.passed}</bpmn2:completionCondition>
      </bpmn2:multiInstanceLoopCharacteristics>

But when I need to use a more complex expression in completionCondition, and specify language="JavaScript", such as content.output.passed == false or content.output.passed+1==2,the engine can't support it, and it all seems to return true. Is there any way to support these more complex expressions in completionCondition?

eyes4 avatar May 07 '24 16:05 eyes4

I’ll have a look.

paed01 avatar May 07 '24 16:05 paed01

I think this #173 might help.

paed01 avatar May 09 '24 12:05 paed01

As far as I can see in the BPMN 2.0 spec only expressions are allowed, although a more competent expression parser than the built-in can be used - ergo @aircall/expression-parser

paed01 avatar May 09 '24 12:05 paed01

When I use @aircall/expression-parser, and try to start the engine, an error occurs.

<ERR_SMQP_CONSUMER_TAG_CONFLICT> Consumer tag must be unique, _inbound-task_create is occupied

I used the same code as #173 This is my bpmn file: flow.bpmn.zip

Could you tell me what is wrong?

eyes4 avatar May 10 '24 09:05 eyes4

Added a test for your flow that attempts to run through all elements. It runs fine so I'm not sure why smqp complained with ERR_SMQP_CONSUMER_TAG_CONFLICT in your environment? It even complained on the first task, which is weird?

Do you use @onify/flow-extensions to support camunda related extensions?

paed01 avatar May 11 '24 07:05 paed01

Added a test for your flow that attempts to run through all elements. It runs fine so I'm not sure why smqp complained with ERR_SMQP_CONSUMER_TAG_CONFLICT in your environment? It even complained on the first task, which is weird?

Do you use @onify/flow-extensions to support camunda related extensions?

Thanks for the test case, it's other bugs in my code. Thanks again.

eyes4 avatar May 12 '24 04:05 eyes4

Can I close this issue @eyes4?

paed01 avatar May 13 '24 07:05 paed01