We have a need for a cascading group/user field in our workflow, however I have not found a add on that does this. By cascading group user field I mean:
Be able to select a JIRA group that then shows a user field that is filtered for only the users in that group. A drop down choice of users instead of a the intuitive type would be the best. Other requirement would be to be able to filter the group field for only certain groups.
Since I haven't found such an add on, my work around I've been playing with is to use a normal cascading choice field that has the values of the groups and names of users in those groups in the field. (Those only about 10 groups needed so this would be pretty easy to manage)
Then with a script runner custom script I am pulling the values out of the first cascading field value (groups) and the second part of the cascading field value (users) and setting those to 2 seperate a text fields.
From there I'd like to be able to set the assignee field with that "user" text fields value. I was wondering if anyone has done something like this. Note the "user" text field is filled in with the Display Name.
I tried to do that using this script. I didn't think the getDisplayableNameSafely was the right thing to use but I didn't find anything else that seemed like it would let me query by the display name(I was testing by trying to set a custom user field before I tried to set the assignee)
def sourceFieldName = "customfield_10253"
def targetFieldName = "customfield_10256"
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()
CustomField customFieldSrc = customFieldManager.getCustomFieldObject(sourceFieldName)
CustomField customFieldTarget = customFieldManager.getCustomFieldObject(targetFieldName)
String sourceFieldVal = issue.getCustomFieldValue(customFieldSrc).toString()
User users = componentManager.getUserUtil().getUsers().each().getDisplayableNameSafely(sourceFieldVal)
User test = users.getEmail()
IssueChangeHolder changeHolder = new DefaultIssueChangeHolder();
customFieldTarget.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customFieldTarget), test), changeHolder)
Any help on where I went wrong would be amazing!
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!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot