How to get new user id created from ProjectRoleUpdatedEvent?

Hi,

I am using ProjectRoleUPdatedEvent to catch whenever a user is added to a project. Below is the code I am using.

import com.atlassian.jira.event.role.ProjectRoleUpdatedEvent
def newUser = event.roleActors.roleActors.stream().map{actor -> actor.parameter}.collect()

It runs successfully and also returns the new user created. But it returns the user name instead of userid as below

[cadence.garfield, jira-users]

alongwith its other group membership.
can someone please help me to get only the userid. for example in this case the user id cadgr.

Help please.

Regards

Hi,

did you try?

def newUser = event.roleActors.roleActors.stream().map{actor -> actor.users}.collect()

@vanthoff,
thanks so much for taking out time to reply to my query.
I have managed to proceed further from this already now.

I am not facing some other problem now.

I want to put a check in my script. I want to detect when a role is updated, is addition or removal of any user to the role.
Is there any method, command, class which i can call to detect this?
Regards

You are welcome.

Sorry for my late reply. I don’t know the ProjectRoleUpdatedEvent in detail, but I would suspect that getOriginalRoleActors() is what you are looking for.