Get Current user from Session

1
+1
-1

Hi, I am trying to get the first name and last name of the user in session.

Can you please help.

Can we do it using connectors?

6 answers

1
0
-1

Hi,

U can try this script:

def firstname = apiAccessor.getIdentityAPI().getUser(loggedUserId).getFirstName(); def lastname = apiAccessor.getIdentityAPI().getUser(loggedUserId).getLastName();

return firstname+" "+lastname;

Put this script in submit button action. Work fine for me. Happy Hunting! *U cant use connector because there is no human logged in that task

Comments

Submitted by estebanfabianp_... on Tue, 10/24/2017 - 19:53

thanks, I served

1
0
-1

Hi,

We got the Username from the session,but only if it is a human task.My doubt is why doesnt it get the username from the current session in Service Task.

Does it hold the session from the time the task is started??Or is a session created only in a human task?

Thanks, Charulatha

1
0
-1

I tried it,It dint work.is there any other way?

1
0
-1

I tried it,It dint work.is there any other way?

Comments

Submitted by bos2013 on Thu, 11/27/2014 - 16:55

Could you please share the process you are using/implementing? Thanks in advance.

Regards, LL

1
0
-1

I am trying the same thing,but how do I get the LoogedUserId

Comments

Submitted by bos2013 on Thu, 11/27/2014 - 15:57

when you open your groovy expression editor you should be able to get it on the field "Select a provided variable..." and in the list there is the LoogedUserId.

When a user executes a process, we know who is the logged user.

1
0
-1

Hello,

I think you should try with following : import org.bonitasoft.engine.identity.User;

User user = apiAccessor.getIdentityAPI().getUser(loggedUserId); String.format("%s %s", user.getFirstName(), user.getLastName());

Regards, LL

Notifications