Hello,
I have a Custom field(Multi User picker), is it possible to copy the names of the selected users to a Text Field
Thanks.
Hello,
As long as I'm understanding your use case, I believe this script will work for you. :)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager
def multiSelect = customFieldManager.getCustomFieldObjectByName("Users")
def users = multiSelect.getValue(event.issue)
def value = []
users.each{
value.push(it.displayName)
}
def textField = customFieldManager.getCustomFieldObjects(event.issue).find {it.name == "Field"}
def changeHolder = new DefaultIssueChangeHolder()
textField.updateValue(null, event.issue, new ModifiedValue(event.issue.getCustomFieldValue(textField), value as String),changeHolder)
You'll need to make this a Script Listener and have it listen on the events you want to check for. For example, I used the 'Issue Updated' and 'Issue Created' events.
Let me know if you have any further questions!
Jenna Davis
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.