How can I get Workflow Variables and Node Variables submitted from my form Task when task is completed?

Hi, I created a event listener and this listen workflowTaskEnded event. In this listener I can not get all my workflow and node variables values, only can get variable comment value.

Why when you fire workflowTaskAssigned event, you add workflow variables and node variables, but when you fire workflowTaskCompleted event, those varialbes are not added as parameters on event context?

Why only variable comment?

@Override
public void endTask(CoreSession session, Task task,
        Map<String, Object> data, String status) throws ClientException {
    String comment = (String) data.get("comment");
    TaskService taskService = Framework.getLocalService(TaskService.class);
    taskService.endTask(session, (NuxeoPrincipal) session.getPrincipal(),
            task, comment, TaskEventNames.WORKFLOW_TASK_COMPLETED, false);

    Map<String, String> taskVariables = task.getVariables();
    String routeInstanceId = taskVariables.get(DocumentRoutingConstants.TASK_ROUTE_INSTANCE_DOCUMENT_ID_KEY);
    if (StringUtils.isEmpty(routeInstanceId)) {
        throw new DocumentRouteException(
                "Can not resume workflow, no related route");
    }
    completeTask(routeInstanceId, null, task.getId(), data, status,
            session);
}
0 votes

1 answers

2280 views

ANSWER



Hello,

You can find some examples in the documentation: How to modify a workflow variable outside of workflow context.

0 votes