Add User picker data to Custom text field

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.

1 answer

1 accepted

1 vote
Accepted answer
Jenna Davis Community Champion Oct 16, 2017

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

60 views 3 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you