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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Fastrack issue based on creator and reporter (not) belonging to specific user group

Edited
Els Bassant
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.
Nov 01, 2023

Hi Community, 

I'm trying to create a fast track issue post function with the following conditions:

  1. creator must be part of a specific group
  2. reporter must NOT be part of a specific group.

If both of these conditions are true then the issue skips the approval step.
If either of these conditions is false the approval will happen as normal.

 

Context:
We have some processes that need approval from a specific team. However, if users from that team create these requests on behalf of someone outside of the team the approval step may be skipped. If members of the team create a request for themselves, it will need approval as normally.

 

I've managed to get the first part working:

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.creator, 'MyUserGroup')

 

But I'm not familiar with groovy scripting and don't know how to add the second condition.

Adding "currentUser != issue.reporter" works and will solve 90% of the use cases. But ideally I'd do this properly.

1 answer

1 accepted

1 vote
Answer accepted
Robert Bailey
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.
Nov 01, 2023

Hi @Els Bassant , 

You can store the results of both queries in variables and then perform an IF statement to return true or false based on your needs. So the code would look like this:

import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()

def creatorInGroup = groupManager.isUserInGroup(issue.creator, 'Test Group 1')
def reporterInGroup = groupManager.isUserInGroup(issue.reporter, 'Test Group 1')


if(creatorInGroup && !reporterInGroup){
    return true
} else {
    return false
}

 

Let me know if this helps! 

Kind regards, 

Bobby

Els Bassant
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.
Nov 01, 2023

This worked perfectly, thank you!

Like Robert Bailey likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events