Hi,
I have made a process using flowable-modeler as shown in image
I have wired the 2 service tasks with 2 spring beans FirstServiceTask and SecondServiceTask, so when I start and run the process from java code like below, it works fine:
Code from Controller:
@PostMapping("/start-service")
public String postRequest(@RequestBody String var) {
Integer num = Integer.parseInt(var);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("enternumber", num);
ProcessInstance instance = mRuntimeService.startProcessInstanceByKey("testmodel", variables);
Task userTask = mTaskService.createTaskQuery().processInstanceId(instance.getId()).taskDefinitionKey("getinput").singleResult();
System.err.println("obtained "+mTaskService.getVariables(userTask.getId()).get("enternumber"));
mTaskService.complete(userTask.getId());
return "ProcessInstance id is "+instance.getProcessInstanceId();
}
FirstServiceTask.java:
public class FirstServiceTask implements JavaDelegate{
@Override
public void execute(DelegateExecution execution) {
System.err.println("FIRST SERVICE TASK");
}
}
Same goes for SecondServiceTask, so typically, when I make a POST call to API: /start-service with any number in the body, based on the value FirstServiceTask or SecondServiceTask is executed.
So, everything works fine when I’m doing like this, but when I try to do it from UI side, it gives me exception of unknown expression, the reason is UI is not aware of this FirstServiceTask and SecondServiceTask classes and I’m not sure how to make them aware of it.
Please find some images attached, which might help to understand the question:
If I would have given number greater than 100 like 127, error would have shown firstServiceTask
in place of secondServiceTask
.
Let me know if any other information is required from my side. Thanks in advance