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

How to Limit an Event Listener to a Specific User Group?

Hello,

I'm sure this is relatively simple, but I've developed an event listener that sends an email when a user is added to a user group, however I want to limit the scope of this listener to only a specific group or set of groups.  What would be an example condition that would allow me to define that?

Thanks!

2 answers

1 accepted

0 votes
Answer accepted

Oddly enough, after taking a break from assembling the solution I was working on, I realized the simplicity of the answer.

event.groupName == 'groupname'

This is all that was needed in the 'Configuration and Condition' field to limit the event listener to only users added to that group.

Hopefully if someone else runs into this issue it helps.

Thanks

0 votes
Ravi Sagar Community Leader Oct 29, 2020

Hi @Kai Lamberson 

In your code you can fetch the group name of a user by something like this.

ComponentAccessor.getGroupManager().getGroupsForUser("user")

I hope it helps.

Ravi 

Hey Ravi,

Appreciate the quick response.  The case here is it's not associated with a specific user.  The listener is notifying us that a new user was added to a group using the GroupMembershipCreatedEvent.  I need to limit the scope to only send a notification if the group equals a specific user group(s).

Suggest an answer

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

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

604 views 15 18
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