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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Scripted fields non display user groups

I have configured a script field in Jira that gets the list of groups from the reporter in an issue and displays the name of the unit depending on the group. But the group names are not displayed if I change Template from Group Picker to Custom or Text-Field.


If template custom or text-line is set, the result is [com.atlassian.crowd.embedded.impl.ImmutableGroup@7d085d23]

Is there any way to convert these to actual group names?

Next, a check will be set to see if the user has a specific group and the text will be displayed depending on that.

import com.atlassian.jira.component.ComponentAccessor

def userGroups = ComponentAccessor.groupManager.getGroupsForUser(issue.reporter)


if(userGroups.contains("Group")){
return "Developer"
}

 

2 answers

1 accepted

0 votes
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 05, 2023

Sure, just use the "getName()" method on the group objects.

Or in shorthand:

import com.atlassian.jira.component.ComponentAccessor
def userGroups = ComponentAccessor.groupManager.getGroupsForUser(issue.reporter)
if(userGroups*.name.contains("Group")){
return "Developer"
}

@Peter-Dave Sheehan

Thank you very much.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events