I want to set 'Component' based on the Reporter's security group membership.
For example:
Employees are in Japan, Guam, and Hawaii.
If an employee from Japan submits a JIRA Service Desk ticket, I'd like to set the 'Component' to 'Japan.' Similar logic applies for employees from Guam and Hawaii. If someone from outside of Japan, Guam, and Hawaii submits a ticket, I'd like to leave the 'Component' blank.
I have ScriptRunner installed but don't know how to write the script.
We are using the latest JIRA enterprise release in Data Center.
Can someone please help?
Thank you!
I'm sure somebody will can give you a complete script, but it's been a while since I've done it, so I'll just provide you with some pointers if you wanted to take a stab at it yourself:
Here's code on how to find check the User Group of an Assignee:
https://library.adaptavist.com/entity/validate-the-user-group-of-the-assignee
So you would want to put something like this in an IF or SWITCH block:
isUserInGroup(issue.reporter, 'japan-users')
And then you'd need to the component, which is documented here:
def japancomponent = projectComponentManager.findByComponentName(project.getId(), "Japan Request")
issue.setComponent([japanComponent])
This would all go in a Post Function after Create. Have fun!
Some other great examples of setting Components based on another field:
https://community.atlassian.com/t5/Jira-questions/Scriptrunner-update-components-based-on-another-select-list/qaq-p/679430
https://community.atlassian.com/t5/Jira-questions/Scriptrunner-Post-Function-Sets-Component-based-on-Single-List/qaq-p/1005354
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much, Darryl. I'll check those links out and try a few things. I'll let you know if it works out. I appreciate your assistance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.