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.
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:
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)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
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