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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,224
Community Members
 
Community Events
184
Community Groups

Display reporter group membership in a ticket

I want to display department of a reporter in a ticket.

Each user is a member of a jira group in format e.g. "department-sales".

We have a lot of departments so I do not want to manually write each department an a automation rule and worry about keeping it up to date. 

I'm thinking if it's possible to write a groovy script that would do something like:

If user is a member of group department-* then custom field Department = group name.

Or any other ideas how I could display single group membership in a ticket?

Without additional plugins.

 

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.
May 25, 2023

Yeah, that could work.

If you already have your department field, I would put this in the workflow "create" transition as a post function. Or in a listener for catching when the reporter changes.

If you don't already have a department field, you could create a new script field.

But ultimately, here is a snippet of code for getting the list of groups for a user (assuming you already have an issue object).

 

ComponentAccessor.userUtil.getGroupNamesForUser(issue.reporter.name).findResults{groupName->
if (!groupName.startsWith('department')) return null //exclude groups that don't start with department
groupName.replaceAll('department-', '') //return just the department
}.join(', ') //in case there is more than 1

That is awesome, thank you! I'll give it a try.

Worked like a charm, thanks again for your help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events