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

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

Assign issue to a specific user if he is NOT part of a group

Edited

Hi all,

When an issue is created, the assignee must be the reporter, but if this assignee is NOT part of a specific group, the assignee must be the project lead.

I was trying to make 2 post functions, the first "assign to reporter" and the next, if current user is not part of a group "X" then assign to specific role or project lead.

I thought that it would be pretty simple and found some links doing similar things with script runner but I have been trying and I can't get it working... I'm pretty useless with scripting, developing and all of this kind of things. The people in my org who are in charge of scripts, listeners, etc, are on vacations right now and I need a resolution as quickly as possible.

Can someone, please, help me?

https://community.atlassian.com/t5/Jira-questions/Groovy-Condition-User-assignee-NOT-in-group/qaq-p/111061 

https://community.atlassian.com/t5/Marketplace-Apps-questions/jira-scriptrunner-user-belongs-to-group/qaq-p/640102

1 answer

Hello Cristian, 

You should be able to do something like this, as long as I read the requirements correctly:

import com.atlassian.jira.component.ComponentAccessor

def assignee = issue.assignee
def reporter = issue.reporter
def lead = issue.getProjectObject().projectLead
def groupA = ComponentAccessor.groupManager.getGroup("GroupA")

if(assignee != reporter){
return false
}
else {
if(!ComponentAccessor.groupManager.getUserNamesInGroup(groupA).contains(assignee.username)){
if(assignee == lead){
return true
}
else {return false}
}
else {return true}
}

 Note: I didn't test this, so typos are possible - let me know if something isn't working.

If this example doesn't help could you send me what you have so far? I might be able to fix up what you've written already. :)

Jenna

Hi Jenna, sorry for the delay,

Another member of my company did it and I see that your solution is different than his solution. Thank you, I will try this in my test local instance and see if this works.

Regards!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

104 views 1 7
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