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

Jira: Is it possible to automatically set the User's Group to a Custom Field by Reporter?

kbestla
Contributor
March 6, 2013

Hi everyone!

I've created a custom field and I would like it to be set automatically to a User's Group by who reported the issue, so that if I'm a reporter in fx jira-developer group, the custom field is set automatically to jira-developer group when I report an issue. I need this cause I would like to be able to get a pie chart of what group is reporting the most / fewest issues.

I've tried the plugin Dynamic Forms but it didn't quite do the trick.

Best regards

Kristín

2 answers

1 accepted

0 votes
Answer accepted
John Bishop
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.
March 6, 2013

If you have the Script Runner plugin installed, then you could try having a Scripted Field which will display the Reporter's group.

In your scripted field, you would need a groovy script like this:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.user.util
import com.atlassian.jira.issue.Issue
import com.atlassian.crowd.embedded.api.User

def componentManager = ComponentManager.getInstance()
def userUtil = componentManager.getUserUtil()
def Reporter = issue.getReporter().getDisplayName();

GroupList = userUtil.getGroupsForUser(Reporter);

return GroupList[0].getName();

That code would just display one group. You'd have to modify it to display more groups.

kbestla
Contributor
March 6, 2013

Thanx guys, you are awesome! :) I'll try this out and hopefully it will work out

kbestla
Contributor
March 13, 2013

I'm getting error when I try to run the script - something you can help with?

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script7.groovy: 2: unable to resolve class com.atlassian.jira.user.util @ line 2, column 1. import com.atlassian.jira.user.util ^ 1 error

0 votes
Gaurav Mishra
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.
March 6, 2013

This is interesting. Do you have just one group for each user? If not, then how do you plan to sort out which group exactly should be in the custom field. I have not done it, but I think a workaround is possible using Jira Suite Utilities and configure a post function to copy values.

kbestla
Contributor
March 6, 2013

Thanx Mishra, I'll check this out! :)

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events