Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Last edited by Full name using script runner

Hi All,

 

I'm using this code to display last updated by a user. I can display a username 

how do I display full name instead of username

below is the code

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def changeItems = changeHistoryManager.getAllChangeItems(issue)

if (changeItems?.size() > 0) {
def userUtil = ComponentAccessor.getUserUtil()
def userkey = changeItems.sort(false).last().getUserKey()
} else {
null
}

 

TIA!!

1 answer

1 accepted

import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.changeHistoryManager
def userManager = ComponentAccessor.userManager

def changes = changeHistoryManager.getAllChangeItems(issue)

def userKey = changes.sort(false).last().userKey
def user = userManager.getUserByKey(userKey)

def name = user.displayName

Getting an error using your code @Roland Holban _Adaptavist_.

 

def name = user.displayName

 [Static type checking] - Cannot return value of type java.lang.String on method returning type com.atlassian.jira.user.ApplicationUser

I'm too late but for everyone who will need in the future:

 

import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.component.ComponentAccessor

ApplicationUser user=ComponentAccessor.getUserManager().getUserByKey(userKey);

log.error(user.displayName.toString())
Like Sara Lam likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Do Not Lose your Customer’s Trust

Missing deadlines is one of the biggest problems every team lead wants to avoid when dealing with managed services. When the customer contracts your company to help with IT services it is expected th...

24 views 0 0
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you