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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Set component based on Reporter's group membership

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!

1 answer

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:

https://scriptrunner.adaptavist.com/5.2.2/jira/recipes/workflow/postfunctions/set-issue-attributes.html

def japancomponent = projectComponentManager.findByComponentName(project.getId(), "Japan Request")

issue.setComponent([japanComponent])

This would all go in a Post Function after Create. Have fun!

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.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Jira

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

638 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you