Search code examples
jbpmbpmn

How to set process variables in Script Task in JBPM 7.3


I have a business process defined with bpmn2 standard and I want to set up a custom object into a Script Task and pass it to a Human Task. There are three process variables:

Process variables

and here is the piece of process:

Business Process

Into Set Object there is the following code:

toBeApproved = new com.myteam.pocapproval.ObjectToBeApproved();
toBeApproved.setCountry(country);
toBeApproved.setAmount(amount);

The problem is that the process variable toBeApproved, after the script task, won't be filled when I start the process passing only country and amount via rest API /server/containers/{id}/processes/{pId}/instances.


Solution

  • I solved appending this kcontext.setVariable("toBeApproved",toBeApproved); to the script task.