I’m using JPBM to design a process flow, with BPMN2. I want to instantiate a class object in a Script Task, for example:
Map<String, Object> params = new HashMap<String, Object>();
Person p = new Person("moi");
params.put("person", p);
ksession.startProcess("com.sample.bpmn.hello", params);
When I go into BPMN and create the process variable, so I can access it inside the script task, I get the following error: “Person cannot be resolved to a type”
How can I access that object through BPMN then? Thanks in advance
Figured it out. When creating the process variable, you have to define it as
Objectand provide the package path in Class Name. Instead of just creating an object, for example, of typePerson, I had to actually typecom.sample.Person, wherecom.sampleis the package name. All variable reading and altering (getandsetmethods) is done withkcontext.getVariable("var")andkcontext.setVariable("var", newValue).Hope this helps anyone 🙂