How to trigger execution of a Java programm automatically within a task in a workflow?

cancel
Showing results for 
Search instead for 
Did you mean: 
reinhacker
Member II

How to trigger execution of a Java programm automatically within a task in a workflow?

Hi there,

I would like to automatically trigger the execution of a Java program as soon as a specific task within a workflow is reached / completed. Furthermore, I need to pass the PROC_INST_ID_ of the current process as a parameter into this program. Is there any example available on how to do this or could anyone give me some hints?

Right now, I am working with the community edition.

Best,

Mario

2 Replies
daisuke-yoshimo
Senior Member

Re: How to trigger execution of a Java programm automatically within a task in a workflow?

How about Execution listener or Task listener?

Activiti User Guide 

Activiti User Guide 

kalpesh_c2
Senior Member

Re: How to trigger execution of a Java programm automatically within a task in a workflow?

Hi , 
Please refer this documentation https://www.activiti.org/userguide/#bpmnJavaServiceTask 

You can get your parameter like this

public class ToUppercase implements JavaDelegate { 
   public void execute(DelegateExecution execution) throws Exception {

    String var = (String) execution.getVariable("input");
    var = var.toUpperCase();
    execution.setVariable("input", var);
  }
}


Thanks,

Kalpesh