AnsweredAssumed Answered

Cannot set value of a non-lvalue expression

Question asked by martin.p on Dec 3, 2013
Latest reply on Dec 4, 2013 by martin.p

My process has custom widgets associated with formProperties. One of these properties may or not be defined, according to an external condition. My main goal is to be able to pass an information to the FormRenderer so that it is able to decide by itself if it should display or not.

I implemented this as follow, and it worked at the beginning, but now I got this weird exception :

Caused by: org.activiti.engine.impl.javax.el.ELException: Cannot set value of a non-lvalue expression 'execution.getVariable('flightEventId')'
at org.activiti.engine.impl.juel.AstMethod.setValue(
at org.activiti.engine.impl.juel.AstEval.setValue(
at org.activiti.engine.impl.juel.TreeValueExpression.setValue(
at org.activiti.engine.impl.delegate.ExpressionSetInvocation.invoke(
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(
at org.activiti.engine.impl.el.JuelExpression.setValue(
… 64 more

Can someone help me understanding this error, or indicate a better way to implement conditional forms?
I am using Activiti 5.10

Process task:

      <userTask id="validate" name="Valider" activiti:candidateGroups="${execution.getVariable(&quot;guarantor&quot;)}">
          <activiti:formProperty id="is-responsible" name="responsability" type="is-responsible" expression="${execution.getVariable(&quot;flightEventId&quot;)}"></activiti:formProperty>

The "is-responsible" form type let us have a IsResponsibleFormPropertyRenderer:

public class IsResponsibleFormPropertyRenderer extends AbstractFormPropertyRenderer {
    public IsResponsibleFormPropertyRenderer() {

    public Field getPropertyField(FormProperty formProperty) {
        boolean visible = isCategoryAssignableForResponsability(formProperty);
        OptionGroup og = buildOptionGroup(visible);
        return og;

    private boolean isCategoryAssignableForResponsability(FormProperty formProperty) {
        String eventFlightId = formProperty.getValue();
        if (eventFlightId != null) {
            FlightEventService flightEventService = ExplorerApp.get().getFlightEventService();
            return getFlightEventCategoryAssignability(eventFlightId, flightEventService);
            return false;           

    private boolean getFlightEventCategoryAssignability(String eventFlightId, FlightEventService flightEventService) {
       … // doing complex things

To summarize, I need to provide a variable to the form that will be used to retrieve informations that let me decide how to render the widget.

Many thanks in advance for your help.