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
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 Join to answer
Community showcase
Emilee Spencer
Published Friday in Marketplace Apps

Marketplace Spotlight: DeepAffects

Hello Atlassian Community! My name is Emilee, and I’m a Product Marketing Manager for the Marketplace team. Starting with this post, I'm kicking off a monthly series of Spotlights to highlight Ma...

64 views 0 3
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot