cancel
Showing results for 
Search instead for 
Did you mean: 

Expression to detect if property not set yet.

mhanrahan
Confirmed Champ
Confirmed Champ
Hi,

In a process I have, I have a loop.  The loop depends on a process variable called "provisioningStatus".  The first time this loop is run (before provisioningStatus has been set, I want to take a different path.

I have tried this using conditional logic on a line rule, however every time I try to access the property to see if it has been set yet, I get the exeption:

<blockcode>
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'provisioningStatus'
        at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.juel.AstUnary$SimpleOperator.eval(AstUnary.java:28)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.juel.AstUnary.eval(AstUnary.java:60)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)[172Smiley Surprisedrg.activiti.engine:5.16.3]
        at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)[172Smiley Surprisedrg.activiti.engine:5.16.3]
</blockcode>

I have tried the expressions:
${provisioningStatus == null}
${empty(provisioningStatus}
${empty provisioningStatus}

Is there another way to find out in JUEL whether a property is not set?
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
"The first time this loop is run (before provisioningStatus has been set, I want to take a different path."

So at that point, the property does not exist.
You can use something like 'execution.getVariable('provisioningStatus') == null'

mhanrahan
Confirmed Champ
Confirmed Champ
That works, thanks.