We want to stop Email notification for Issue update event for Issue with Closed status.

Sanjay Krishnan R.S. January 24, 2016

As I have analyzed through Atlassian community, it looks like I have to hack the core code of issue updated listener. Is it like should i create a listener and check whether the event is issue updated and then the issue status and then flag off notification? If yes, how to flag off notification via code. Please input

or, Is it I have to edit the core JIRA code, then Can you help me where to add that if condition ?

2 answers

1 accepted

1 vote
Answer accepted
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 25, 2016

At a high level, this is pretty straightforward:

  • Remove the notification from your notification scheme(s) for "Issue Updated".
  • Create a custom event "Closed Issue Updated".
  • Add a custom listener via Script Runner that listens for the "Issue Updated" event, and emits "Closed Issue Updated", with a simple condition based on the Issue Status.  Emitting events is a pre-built listener, and the condition should be simply (issue.getIssueStatus().getName()=="Closed") (there may be a built-in status-based example as well, I didn't check).  I'd make it for all projects, since the event is generically applicable.
  • Add the appropriate "Closed Issue Updated" notification to your notification scheme(s).

This approach is fairly non-intrusive; from the listener side, you are basically just adding a conditional event, and each project admin can choose to notify on it, or not, as is appropriate.

Actually, it looks like you wanted "Open Issue Updated".  If it was me, I'd create both events and two listeners, so you have complete flexibility (an admin may want to see the closed updates).  Just invert the logic of the condition for the "Open" event.

 

1 vote
Tibor Hegyi _META-INF_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 24, 2016

Creating a new listener may not help you, because unless you remove the notification scheme from the project, JIRA will dend event notifications. If you remove, issue updated event grom the scheme, your listener will have to implement the update notification as you described. There may be several addons that support what you need, one of them is email this issue: https://marketplace.atlassian.com/plugins/com.metainf.jira.plugin.emailissue/server/overview

Beside many other things, It has support for conditional notifications out of the box.

Sanjay Krishnan R.S. January 24, 2016

@Tibor Hegyi [META-INF] : As our requirement is only this, I am not fully agreeing in buying an addon. I believe we can develop a plugin for this specific requirement. I wanted to know, If I have configured issue update notification, is there any ways in writing a listener and setting notification off for that particular issue based on defined conditions ?

 

Like issueeventdispatcher -> setnotification false. Will it have any effect ? I want to know before I put effort.

 

Thank you for you inputs. If you can help, I would be more happy smile

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 24, 2016

No, JIRA is going to pick up the "issue updated" event and fire a notification whatever you do.

You do not need to hack the core code, but you do need a new listener or something like the add-on Tibor mentions.

Without the addon, you will need to find/write a listener that sends an email when it detects "issue updated".  JIRA's notification stuff works like that already, but the bit you need to add is "unless status is closed".

Once you have that working, or you've used the suggested add-on, you then change your notification scheme so that it sends mail to nobody on the issue updated event (because the listener or add-on will be sending a duplicate)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events