Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

script field to display a string of users display name based on multi-user picker cf

Ronen Ahuvia June 22, 2016

Hello,

I'm using JIRA 7 and script runner.

I'm trying to write a groovy script field which will hold a string with the display names of the selected users in a multi-user picker custom field.

I can't figure out how to do it.

Any Ideas?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 22, 2016

Here my code for JIRA 6.4. Hope it is compatible for 7:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.user.ApplicationUser

CustomField multiuserCstFld = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Соисполнители")
if (multiuserCstFld == null)
    return "custom field not found"

StringBuilder result = new StringBuilder();

for(ApplicationUser user: (ArrayList) multiuserCstFld.getValue(issue))
    result.append(user.getName() + "/")

return result.toString().substring(0, result.toString().length() - 1)
TAGS
AUG Leaders

Atlassian Community Events