Hello
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:
Method1:
def PMField = customFieldManager.getCustomFieldObjectsByName("My PM")
thisIssue.setCustomFieldValue(psirtPMField[0],PMUser)
Method2:
def PMFieldSingle = customFieldManager.getCustomFieldObjectByName("My PM")
thisIssue.setCustomFieldValue(psirtPMFieldSingle,PMUser)
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.
Thanks
Abe
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
Utkarsh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That was not the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.