Receiving notifications when a user from a particular group creates a ticket

Daniel Pasacrita January 22, 2016

Hi everyone, we're looking for a way to have a user notified whenever a particular user (or user from a particular group) opens up a ticket in any project. So basically the second one of those users creates a ticket, this master user will get an email notification informing them of the creation.

I'm familiar with some of the reporting features, such as creating a filter for these user's issues and sending a report out every night, but it doesn't look like that's what we're looking for. I'd prefer to do this without any paid plugins if possible, as getting those things approved for purchase is kind of difficult.

1 answer

1 vote
Jeremy Gaudet
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.
January 22, 2016

I've done this with a custom listener; first I created a custom event, then I used the script runner listener for firing the event when a criteria was met, with the criteria being that the user was a member of the group.  Then I added a notification for that event using the "issue updated" email template.

More streamlined would be to just emit a custom email and bypass the custom event, but then you'll need to write your own email template.  There are pros and cons to both approaches; in this case, since you want it for all projects, you probably don't want the event as then you need to trust that every notification scheme will maintain the correct notification.

Rob Horan
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.
January 22, 2016

Are there any tutorials for writing listeners?

Jeremy Gaudet
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.
January 22, 2016

You wouldn't have to write this one, beyond the condition.  The interface provides examples, I'll take a look and see if this is one of them.

Jeremy Gaudet
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.
January 22, 2016

For both "Fires an event when condition is true" and "Send a custom email", built-in listeners, there is a sample condition for "Reporter is in a particular group":


import com.atlassian.jira.component.ComponentAccessor

def groupManager = ComponentAccessor.getGroupManager()
groupManager.isUserInGroup(issue.reporter?.name, 'business-users')


So (as a JIRA admin) you'd go to Administration / Add-ons, then "Script Listeners" underneath "SCRIPT RUNNER" along the left.  Then "send a custom email", project key "All Projects", Events "Issue Created", Condition as described above, adjusting for your group name, then provide an email template and a subject template.  Something like:

Subject:

Issue: $issue.key  opened by user/group X

Email:

Issue: $issue.key  opened by user/group X

Suggest an answer

Log in or Sign up to answer