Hm...
Technically there is a way, but as I said it is not PublicAPI, so there is no guarantee that it will not break when you update.
You can create a ProgramStart, e.g. something like:
And then in the bean of this ProgramStart you can listen for workflow events, something like:
public class WorkflowListenerBean extends AbstractProcessStartEventBean implements IWorkflowListener {
private IWorkflowManager manager;
public WorkflowListenerBean() {
super("TestBean", "Description of TestBean");
manager = IWorkflowManager.instance();
}
@Override
public void start(IProgressMonitor monitor) throws ServiceException {
super.start(monitor);
manager.addWorkflowListener(this);
}
@Override
public void stop(IProgressMonitor monitor) throws ServiceException {
super.stop(monitor);
manager.removeWorkflowListener(this);
}
@Override
public void workflowChanged(WorkflowChangeEvent changeEvent) {
if (IWorkflowEvent.class.equals(changeEvent.workflowObjectClass())) {
var event = manager.findWorkflowEvent(changeEvent.workflowObjectId());
if (event.getEventKind() == WorkflowEventKind.EVENT_DESTROY_TASK) {
String firingReason = "";
Map<String, Object> parameters = new HashMap<>();
try {
getEventBeanRuntime().fireProcessStartEventRequest(null, firingReason, parameters);
} catch (RequestException ex) {
ex.printStackTrace();
}
}
}
}
}
You can also access the current task from this event e.g. via event.getTask()
But be careful, e.g. you cannot use Ivy API inside of the workflowChanged method, as you have no guarantee that the code runs on the correct thread where the Ivy environment is correctly setup.