-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.6.0-HF01, 5.7.1
-
Component/s: None
The CreateTaskUnrestricted#createTask method creates the Task document in the session before having set its process id (= workflow id), and by the way other task properties such as name, type, creation date:
DocumentModel taskDocument = session.createDocumentModel(parentPath, docName, taskDocumentType); taskDocument = session.createDocument(taskDocument); Task task = taskDocument.getAdapter(Task.class); if (task == null) { throw new ClientRuntimeException("Document " + taskDocumentType + " can not be adapted to a Task"); } task.setName(taskName); task.setType(taskType); task.setProcessId(processId); task.setCreated(new Date());
This is a problem because if you we have a listener on the documentCreated core event triggered by such a Task document creation, then it won't be aware of these Task properties.
Typically we need to have the processId for instance to fecth the workflow input document.