IfPart condition


#1

Hi guys

I have searched high and low for some IfPart coding examples to model Flowable with. Sadly enough I have not been able to succeed in generating a working model.

Which language or what expression do I use to define my IfPart conditions?

Thank you in advance


#2

Hi,

You can use expressions. For example

Regards
Martin


#3

Thank you for the example Martin.
Would be able to send me in the right direction of what the expression would say if the id of my data was ‘surveyvalidation’ and the answer to the question is ‘incorrect’, selected from a drop-down. What would I insert into the Condition value in Flowable?


#4

Any expression works, so it can range from ${suveryValidation == 'incorrect'} to ${someValidationService.validate(planItemInstance)} (where someValidationService) is a Spring bean.


#5

Hi Joram, thanks for the response. As a consequence of your reply I wanted to give it another shot.

When entering the ifPart condition of {surveyvalidation == 'incorrect'}, in the logging I'm receiving the error: "Unknown property used in expression {surveyvalidation == ‘incorrect’}. This then results to "Caused by: org.flowable.common.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘surveyvalidation’.

*I have of course put the $ sign in the conditions, it just won’t show in this message.

Also, when an ifPart condition of mine would be the completion of the task ‘Fill out Survey’ with the ID ‘filloutsurvey’. When I put this into a condition, namely: ${filloutsurvey == ‘complete’}, I receive the same error.

What am I doing wrong here?


#6

The reason is that conditions are evaluated right on case instance start… but the variable is not yet there.
To fix this, you can use a function expression like ${var:get(surveyvalidation) == ‘incorrect’}. See https://flowable.org/docs/userguide-cmmn/index.html#cmmnExpressionsFunctions for more information.

We’re actually adding some tweaks to the ifPart resolvement right now and we’ll update the documentation to cover this topic too.