cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Task get Documentation

alfrescot3ster
Champ in-the-making
Champ in-the-making
Hello!

I have a custom task like:


<userTask id="usertask1" name="User Task 1" activiti:assignee="${initiator.properties.userName}">
      <documentation>
        This is the documentation and I want it
      </documentation>
      …
</userTask>


Now I want to get this documentation via Java API. "WorkflowModel" does not contain any property with "documentation", also the "WorkflowTask" itself does not contain any method like "getDocumentation()". I just find things like: "workflowTask.getPath().getInstance().getDescription()" or "workflowTask.getPath().getInstance().getDefinition().getDescription()" but nothing more.

Someone knows how to get the documentation of a task in Java?
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

using the Alfresco API you cannot get to that field. There simply is no mapping for it. Only via low-level Activiti API can you get to it, i.e. by developing a task listener that copies the "documentation" value to an Alfresco task model property when the task is created.

Regards
Axel

alfrescot3ster
Champ in-the-making
Champ in-the-making
Oh, thanks that helped me a lot. Searched everywhere for hours Smiley Sad

christianjanker
Champ on-the-rise
Champ on-the-rise
workflowTask.getDefinition().getNode().getDescription() should be the documentation if it is set in the bpmn definition. The ActivitiTypeConverter maps it within the getNode method.

afaust
Legendary Innovator
Legendary Innovator
You are right - the workflowTask.getDefinition().getNode().getDescription() actually maps to the documentation, but this appears to be sheer luck / accident. Along the execution path, every variable referring to the value is called "description" and only the ActivitiConstants.NODE_DESCRIPTION constant contains the non-sensical value "documentation", so it ends up mapping that as a "pseudo-description". This is kind of dirty and I would not rely on it always staying this way.