Workflow name in a servlet
Hi,
I have a workflow that includes a dialog participant step, and I am invoking a servlet to retrieve dropdown values. I have two different workflows calling the same servlet, and now I want to know the workflow name within the servlet. I tried the code below, but the workItem is always null.
Any help is appreciated. Thank you.
WorkflowSession workflowSession = request.getResourceResolver().adaptTo(WorkflowSession.class);
if (workflowSession != null) {
WorkItem workItem = (WorkItem) request.getAttribute("com.adobe.granite.workflow.exec.WorkItem");
if (workItem != null) {
Workflow workflow = workItem.getWorkflow();
WorkflowModel workflowModel = workflow.getWorkflowModel();
String workflowModelId = workflowModel.getId();
String workflowModelTitle = workflowModel.getTitle();
log.info("Workflow Model ID: {}", workflowModelId);
log.info("Workflow Model Title: {}", workflowModelTitle);
}
}
