08-05-2019 10:44 AM
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
08-05-2019 01:55 PM
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
08-05-2019 01:55 PM
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
08-06-2019 01:20 AM
Hi,
You can also use "delegateTask.getAssignee();" to get assignee of UserTask.
Thanks,
Vidhi
Explore our Alfresco products with the links below. Use labels to filter content by product module.