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
Solved! Go 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");
Or in Javascript
bpm_assignee.properties.userName
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");
Or in Javascript
bpm_assignee.properties.userName
Hi,
You can also use "delegateTask.getAssignee();" to get assignee of UserTask.
Thanks,
Vidhi
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.