Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Scriptrunner update user picker single select


I need to set the value of user picker

I have PMUser of type ApplicationUser.

I am trying to set the value of user picker. and tried 2 ways:


def PMField = customFieldManager.getCustomFieldObjectsByName("My PM")



def PMFieldSingle = customFieldManager.getCustomFieldObjectByName("My PM")



I am getting cannot find matching method for setCustomFieldValue for both ways. setCustomFieldValue should have customfield and object as parameters right. Where could be the issue.

Please let me know.




2 answers

1 accepted

0 votes
Answer accepted

For anyone having similar issue, I was using Issue instead of MutableIssue. 

Hi @AbrahamA ,

getCustomFieldValue() expects you to pass in a singular custom field object. Are you passing in a collection of custom field objects, because you must be using getCustomFieldObjectsByName() to get the user field. That seems to be causing the error.

If yes, you can try something like:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def userManager = ComponentAccessor.getUserManager()
def user1 = "user name"
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def userCf = customFieldManager.getCustomFieldObjectByName("field Name")
def user = userManager.getUserByName(user1)

issue.setCustomFieldValue(userCf, user)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)

Kind Regards

That was not the issue.

Suggest an answer

Log in or Sign up to answer

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