How to get bpm_assignee username?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
upforsin
Established Member

How to get bpm_assignee username?

Jump to solution

The user is choosing bpm_assignee in the UserTask.

Now how can I get the username of this bpm_assignee in Java/Javascript?

I know i can use ${bpm_assignee.properties.userName} in the process definition. But I have to get the username in the taskListener or ServiceTask.

I tried almost everything but but nothing seems to work.

  I tried to fetch bpm_assignee by:

Object assignee = execution.getVariable("bpm_assignee");‍‍

but then there is nothing i can do with this object. When I print I get:

Node Type: {http://www.alfresco.org/model/content/1.0}person, Node Aspects: [{http://www.alfresco.org/model/content/1.0}ownable, {http://www.alfresco.org/model/system/1.0}cascadeUpdate, {http://www.alfresco.org/model/system/1.0}referenceable, {http://www.alfresco.org/model/system/1.0}localized]

When I invoke getDeclaredFields(), only serialVersionUID is shown,

When I invoke getVariableInstance() I get:

VariableInstanceEntity[id=32615, name=bpm_assignee, type=alfrescoScriptNode, textValue=workspace://SpacesStore/3a93aa03-b6b7...]

assignee.properties.userName is undefined (or null).

What can I do?

Regards,

Mike

1 Solution

Accepted Solutions
upforsin
Established Member

Re: How to get bpm_assignee username?

Jump to solution

OK, i set up the debugger and it happened to be very simple.

Previously i tried: execution.getVariable("bpm_assignee").getProperties().get("userName");

But the solution is:

String name = execution.getVariable("bpm_assignee").getProperties().get("{http://www.alfresco.org/model/content/1.0}userName");
2 Replies
upforsin
Established Member

Re: How to get bpm_assignee username?

Jump to solution

OK, i set up the debugger and it happened to be very simple.

Previously i tried: execution.getVariable("bpm_assignee").getProperties().get("userName");

But the solution is:

String name = execution.getVariable("bpm_assignee").getProperties().get("{http://www.alfresco.org/model/content/1.0}userName");
vidhipanchal
Established Member

Re: How to get bpm_assignee username?

Jump to solution

Hi,
You can also use "delegateTask.getAssignee();" to get assignee of UserTask.

Thanks,

Vidhi

ContCentric