groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.user.util.User

Hi,

we have below Resolved By script filed code. 

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.user.util.UserManager;

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

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

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

 

most of the time it is throughing below error while script field execution, could you please some one help on this issue.

 

2017-04-07 00:35:52,136 ERROR [customfield.GroovyCustomField]: Script field failed on issue: WM-107149, field: Resolved By
groovy.lang.MissingMethodException: No signature of method: static com.atlassian.jira.user.util.UserManager.getUserByKey() is applicable for argument types: (java.lang.String) values: [sokumari]
at Script4$_run_closure2.doCall(Script4.groovy:11)
at Script4.run(Script4.groovy:11)

1 answer

This widget could not be displayed.

Hi Ramaiah,

It looks like you are trying to reference a non-static symbol from a static context.

You will need to create a new UserManager object. i.e:

def userManager = ComponentAccessor.getUserManager()

Then call the getUserByKey() method on this object.

Regards,

Johnson Howard

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

79 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you