Getting user login

vitor_silva December 3, 2020

Hey guys, i'm trying to get user login on JIRA using ScriptRunner like:

def jiraUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

but the return is XXXXXX(xxxxxx) and all i want is XXXXXX.

So, how can i get only the XXXXXX?

 

OBS: def jiraUser = ComponentAccessor.getJiraAuthenticationContext().getName(); returns XXXXXX(xxxxxx) to.

OBS2: I don't want to user replace things to remove (xxxxxx), it need to be something simple.

1 answer

1 accepted

0 votes
Answer accepted
Raynard Rhodes December 3, 2020

You can use .displayName 

or whatever options are here https://docs.atlassian.com/software/jira/docs/api/8.5.4/

 

You can always add .class at the end to see what to look up in the docs.

vitor_silva December 3, 2020

.displayName didn't work for me, but i will search on documentation.

EDIT: 

def jiraUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().getName(); worked perfectly.  I just added .getName();

Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events