Invoking multiple methods in an expression

I am creating a process that uses a result variable in downstream process steps. I got to a case where I would want to invoke multiple methods/set multiple values in an expression statement, however I do not see how to do this.

In the modeler there is a ‘Class Fields’ extension, however I do not see documentation for this.

As a reference I have been looking at the Spring JPA example:

    <serviceTask id="createLoanRequest" name="Create loan request"
                 activiti:expression="${loanRequestBean.newLoanRequest(customerName, amount)}"
                 activiti:resultVariable="loanRequest"/>


Here the newLoanRequest call returns the loanRequest result variable that will go through the process.
Later on loanRequest.setApproved is invoked.

Say the loan is approved, but for a different amount.
Are you able to invoke loanRequest.setApproved and loanRequest.setAmount in the same expression or through the ‘Class Fields’?
Or do you have to create a loanRequest.setApprovedAndAmount method?

Hi,

In an Expression you can only invoke one method. What I’ve seen being done a lot, is to have a ApproveTask bean that takes the execution variable as input, like: ${approveTask.execute(execution)} and then implement any logic in the ApproveTask. You can set any variable and invoke any method there.

Best regards,

Tijs

Thanks, that works well.

It is possible to invoke multiple methods in single EL expression. See how is is done

https://github.com/flowable/flowable-engine/issues/183

Thanks