• Community
  • Products
  • Jira
  • Questions
  • Jira > Script Runner > Scripted fields: Is it possible to return certain Group by certain issuetype if reporter in more than one group?

Jira > Script Runner > Scripted fields: Is it possible to return certain Group by certain issuetype if reporter in more than one group?

Good Friday good People :)

I've created a Custom Field (with good help from the people at this forum ;) ), called Reporter Group, and that field is automatically filled out by Reporters User Group when an issue is created.

I ran into some issues to begin with, cause some users are in more than one group but got a solution to that. The reason for me doing this, is because I wanted to be able to see in a pie chart what group is reporting most / fewest defects.

I've put the script below so you can see how above mentioned it's done... BUT... now I'm wondering if I can change the script to set the Reporter Group field by an IssueType, for certain User Groups. For an example if a user is in two groups that I don't want to ignore, then the issuetype sets the field.

Fx. If I'm a reporter in two groups, one called jira-techsupport and another called jira-servicesupport, and if I report an issutype called techsupport, the reporter group is filled out as jira-techsupport, but if I report a regular bug (or something else than techsupport issue) the reporter group is filled out as jira-servicesupport, and this only applies if user is in those two groups, not he's in 'jira-qa' group etc.

Here is the script I'm using now, and works well, but would like to add the issuetype as mentioned above to it.

import com.atlassian.jira.ComponentManager

import com.atlassian.jira.security.groups.GroupManager

GroupManager groupManager = ComponentManager.getComponentInstanceOfType(GroupManager.class)

GroupList = groupManager.getGroupsForUser(issue.getReporterId()).name;

ignoredGroups = ['jira-users', 'jira-administrators'];

resultGroups = GroupList - ignoredGroups;

return resultGroups[0];

Best regards

Kristín

1 answer

1 accepted

1 vote
Henning Tietgens Community Champion Apr 25, 2013

You can get the issuetype with

issue.issueTypeObject.name

Henning

Thank you Henning :)

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 Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

639 views 6 12
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