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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

49 views 0 4
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