Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get user full name who ever transitioned the jira issue

Ramaiah Pendli May 30, 2017

Hi,

we are using below script to get the Rejecter user id when the issue moved to Rejected state but we require the full name in custom filed. plz some one help me to get the user full from the statement bolck "def userid = changeItems.collect { userUtil.getUserByKey(it.userKey).name}" 

import com.atlassian.jira.component.ComponentAccessor;

def historyManager = ComponentAccessor.getChangeHistoryManager()
def userUtil = ComponentAccessor.getUserUtil()

def changeItems = historyManager.getAllChangeItems(issue).findAll { changeItem ->
changeItem.field == "status" && changeItem.toValues.find{ it.value == "Rejected"} && !(changeItem.fromValues.find{ it.value == "Rejected"})
}

def userid = changeItems.collect { userUtil.getUserByKey(it.userKey).name}
if(userid)
userid.last()

1 answer

0 votes
Alex Corsun December 11, 2017

Perhaps this would work for you: 

def userid = changeItems.collect { userUtil.getUserByKey(it.userKey).getDisplayName()}

Suggest an answer

Log in or Sign up to answer
TAGS
Atlassian, Team '25 Europe, Atlassian conference, AI-powered teamwork, Atlassian events, keynote speakers, Barcelona tech conference, Atlassian Williams Racing, Carlos Sainz, Jenson Button, Mike Cannon-Brookes, Anu Bharadwaj, Atlassian Rovo

Atlassian Williams Racing is coming to Team '25 Europe 🏎️

Discover the teamwork and precision behind success on and off the track. See how this high-performing team makes the impossible possible. Be one of the first 100 customers to register for a chance to win 2 tickets to an Atlassian Williams 2026 race.

Register now
AUG Leaders

Atlassian Community Events