Having the members of groups info somehow listed in Issue?

Hello,

we have a system build in a way that people are grouped up under affected components in a custom multiple group picker field called "Komponenten". Everything is dependant on those groups and system works fine but for users and process supervisors it would be important to know who the people behind affected component are for this whole process to be more transparent. At the moment we are keeping list of components and people in charge of them in external Excel sheet so you can imagine we want to improve that.

Is there a way to get this somehow with Script runner and Scripted field maybe? Custom field or any other suggestion is welcome.

Best regards,

Rok

1 answer

1 vote

That's a perfect use-case for a scripted field, and almost one I've done myself quite recently.  The group-picker I used was a single select, and they specifically wanted just the user names as a long block of text, but the code below should get you started.

 

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("Group to List")
def theusers = groupManager.getUserNamesInGroup(issue.getCustomFieldValue(cf))

return theusers.toString()

I forgot - there's a minor problem with scripting this. If the members of the group are changed, the results of the scripted field will be wrong until the issue is re-indexed (i.e. project re-index or any edit or transition on the issue)

Isn't the contents updated when you view the issue, but searching needs to wait for the issue to be reindexed?

Thank you both for your answers! I'll try to adjust the code so that it works with multiple group picker field somehow. About re-indexing, I don't know what are we going to do, we can try to ask from admins when they make a group modification to do re-index or something. Cheers, Rok

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
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

94 views 0 1
Join discussion

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