Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

how to validate a users in a particular group in jira using groovy

Hi all, we have 5 users in Jira-admins group so we don't want add any add any other user to that group, if any user accidentally added to that group then an eamil has to be sent to me or my manager ...


Hi Pantham,

Everything you need to create a script like that is here (listing users in a given group), and here (sending e-mails using groovy). Based on this, you can create a script that does what you need. It could be a scripted service that runs the script periodically, ScriptRunner allows for this.

I encourage you all to follow my Groovy for Jira Blog.

Hi @Mentorship4Utnq for quick response but  the answer is not suitable for me becoz we don't want add a new user to admin group bt in that link the user want add a users to another group.

Ismael Jimoh Community Leader Jul 14, 2021

@Pantham Akhil there is no way to stop your administrators adding users to a specific group. 

As such, the first thing is to do here is to make sure that the administrator group is not set as a default user group users can be added into.

Next, as suggested by @Mentorship4U build a script whenever a new user is added to the group so you can see and validate if it is indeed needed. You can then go to the audit log page to confirm who added the said user to the group and confirm why as well.

Unfortunately, there is no way to directly stop an administrator from adding a new user to a group.

You can consider raising a feature request at (do check if such a feature request exists first before raising a new one and vote for existing ones.)

Hi @Ismael Jimoh tnq for the response we don't want to stop admins to stop adding users to that group the admin accidentally add any new user to jira-admins group then one email needs to be sent to an admin either me r others. so the script needs to compare the hard codded list of admins and new list everyday and if there is any new user added then it needs to be notified by sending an email. This is what my exact requirement. can you please help me in this . tnq



Ismael Jimoh Community Leader Jul 15, 2021

Hi @Pantham Akhil 

Are you asking for us to write the script for you? From my understanding of your prior comment you said you wanted a notification before the user is added which as I explained isn’t possible.

Please clarify what help you need exactly.


Log in or Sign up to comment

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