cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco - Get username in workflow activiti

pat9rv3sousa
Champ on-the-rise
Champ on-the-rise
I'm searching for the username of assignees when I create on a workflow…

I use this:


public void notify(DelegateExecution execution){
   // get value of property mymodel:myproperty
   Object assignees = execution.getVariable("bpm_assignees");
}


When I get bpm_assignees i get this:


bpm_assignees map value: [Node Type: {alfresco.org/model/content/…}person, Node Aspects: [{alfresco.org/model/content/…}ownable, {alfresco.org/model/system/1.0}referenceable, {alfresco.org/model/system/1.0}localized], Node Type: {alfresco.org/model/content/…}person, Node Aspects: [{alfresco.org/model/content/…}ownable, {alfresco.org/model/system/1.0}referenceable, {alfresco.org/model/system/1.0}localized]]


How can I get username?

Thank you so much!
1 REPLY 1

gdharley
Elite Collaborator
Elite Collaborator
Seems like you should be using a taskLstener rather than an executionListener since this will give you the TaskDelegate directly.
But if for some reason you MUST use an executionListener then somethign like this should do the trick:

    String executionId = execution.getId();
    Task theTask = execution.getEngineServices().getTaskService().createTaskQuery().executionId(executionId).singleResult();
    String theAssignee = theTask.getAssignee();