There is yet no public API for that available. But there is an internal workflow event API that could handle this job - and the classes are accessible. So you can use it, but there is no guarantee that this API will not be changed or broken in the future.
The following sample code shows how you can track newly created cases. Many other events are also available: see the class ch.ivyteam.ivy.workflow.WorkflowEventKind
public class CaseCreatedListener implements ch.ivyteam.ivy.workflow.IWorkflowListener{
public static void register(){
IWorkflowManager workflowManager = ServerFactory.getServer().getManager(IWorkflowManager.class);
workflowManager.addWorkflowListener(new CaseCreatedListener(workflowManager));
}
private IWorkflowManager wfManager;
private CaseCreatedListener(IWorkflowManager wfManager){
this.wfManager = wfManager;
}
@Override
public void workflowChanged(WorkflowChangeEvent event) {
if (event.getEventKind() != WorkflowChangeEventKind.CREATED){
return;
}
IWorkflowEvent createEvent = wfManager.findWorkflowEvent(event.getId());
if (createEvent.getEventKind() != WorkflowEventKind.EVENT_CREATE_CASE){
return;
}
ICase newCase = createEvent.getCase();
Ivy.log().info("new case created: "+newCase);
}
}
I've created a little demo project: [wfEventListener_51.iar][1]
[1]: http://developer.axonivy.com/q-and-a-attachments/wfEventListener_51.iar/upfiles/wfEventListener_51.iar