cancel
Showing results for 
Search instead for 
Did you mean: 

Want to display the name of the logged in user in people control of activiti form.

michael1993
Champ in-the-making
Champ in-the-making
Hi There,
I am very new to this activiti. I created a process which has one user task and one service task. In user, I attached a form which has a people control in it. When a user lauches this process through an app, the username of the user who launched the app should come in the people control automatically. I attached one task listener to the process. But it is giving me only the id of the logged in user.

6 REPLIES 6

michael1993
Champ in-the-making
Champ in-the-making
degatetask.setVariable
("user", delegateTask.getA­ssignee ( ) ) ;

User is the id of the people control.

michael1993
Champ in-the-making
Champ in-the-making
Can anyone there help me on this?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Michael,

http://activiti.org/userguide/index.html#bpmnStartEvents

initiator: identifies the variable name in which the authenticated user id will be stored when the process is started. Example:


Regards
Martin

michael1993
Champ in-the-making
Champ in-the-making
Sorry, but I am not sure how and where to use this.

Below is my tasklistener which I configured with my process.

public class DelegateTaskListener implements TaskListener{

@Override
public void notify(DelegateTask delegateTask) {

  delegateTask.setVariable("user", delegateTask.getAssignee());
   
}

}

But it is giving me only id of the user after starting the process.  But I want name of the user.


I got id of the user in "User" field. But when I select my name from the drop down of the "Default Assignee", it is showing me the name.
I need the same in "User" as "Default Assignee".

jbarrez
Star Contributor
Star Contributor
Not sure I'm following, but I think you need to use the 'initiator' variable here. It stores the id of the user that started the process instance.

madn
Champ in-the-making
Champ in-the-making
How to use the initiator variable ?

Are you using java-code ? Javascript ? script task ?