I have an issue with copying single user picker value and multi user picker to multi user picker value.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.event.type.EventDispatchOption
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def cfMgr = ComponentAccessor.getCustomFieldManager()
def changeHolder = new DefaultIssueChangeHolder()
def cfMultiSelectUser = cfMgr.getCustomFieldObject("customfield_19221") //multi
def cfMultiSelectUserValue = issue.getCustomFieldValue(cfMultiSelectUser)
def cfSingleSelectUser3 = cfMgr.getCustomFieldObject("customfield_19224") //single
def cfSingleSelectUserValue3 = issue.getCustomFieldValue(cfSingleSelectUser3)
def cfMultiSelectUser2 = cfMgr.getCustomFieldObject("customfield_19223")
def cfMultiSelectUserValue2 = issue.getCustomFieldValue(cfMultiSelectUser2)
cfMultiSelectUserValue2.push(currentUser)
cfMultiSelectUser2.updateValue(null, issue, new ModifiedValue(cfMultiSelectUserValue2, cfMultiSelectUserValue, cfSingleSelectUserValue3),changeHolder)
it is working, but when trying to addition single user picker as the copy field always value is just empty.
Hi Dmitry,
Can I please ask if you are using ScriptRunner for Jira Cloud as you have marked your question as Jira Cloud but have included code for Jira Server which is not valid inside of Jira Cloud.
If you require assistance with this question relating to Jira server, you should remove the tag for Jira Cloud and add in the tag of com.onresolve.jira.groovy.groovyrunner so that other users of the Server version can see this question and can advise on it.
Regards,
Kristian
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.