How can I access the history of a Workflow instance using the Adobe AEM api for java? Say I've created one workflow which contains 3 workitems. I want to access the details associated with all the workitems for that workflow (E.g.Status,Title,User,StartTime,EndTime,Action,Comment).
2 Answers
Take a look at the following classes.
com.day.cq.workflow.WorkflowSession
https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowService.html
and
com.day.cq.workflow.WorkflowSession
https://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/workflow/WorkflowSession.html
If you want to see a code example on how to filter on a particular workflow instance, you can find a lot of documents in the following file of your AEM instance:
/crx/de/index.jsp#/libs/cq/workflow/components/console/archive/json.jsp
In summary, you will need to create a workflow service and fetch the model to iterate over it's instances to apply relevant filters.
Alternatively, you can write a query to get data from /var/eventing/jobs node which is essentially a workflow instance data store.