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 disable issue filter subscriptions for all users

Tayyab Bashir Feb 02, 2016

Hi, 

I have a Test instance of JIRA on which I am doing some testing and need emails to be enabled.

But there are many filter subscriptions on it from many users (as its the XML backup of production server).
Is there a way to disable JUST the issue filter subscriptions and keep everything else intact? 

Thanks 

2 answers

1 vote
Vasiliy Zverev Feb 02, 2016

You can diable out mail at all: admin panel => system => mail => out mail => press button disable

Tayyab Bashir Feb 02, 2016

Hi, 
I don't want to disable all the emails, I want to disable just the filter subscriptions. 

Vasiliy Zverev Feb 02, 2016

Then you can try execute this code to delete all subsriptions (for example, via Script Runner)

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.subscription.FilterSubscription
import com.atlassian.jira.issue.subscription.SubscriptionManager

SubscriptionManager subscriptionManager = ComponentAccessor.getSubscriptionManager();
for(FilterSubscription subscription: subscriptionManager.getAllFilterSubscriptions()){
    subscriptionManager.deleteSubscription(subscription.getId())
}

DO NOT EXECUTE IT ON PROD INSTANCE

Tayyab Bashir Feb 03, 2016

This didn't do anything? 

Vasiliy Zverev Feb 03, 2016

It should to delete all subsriptions.

Tayyab Bashir Feb 03, 2016

It does run but it doesn't delete the filters. I tried re-indexing as well. 

Capture.PNG

 

FYI: JIRA Version: 7.0.5

Vasiliy Zverev Feb 04, 2016

This script does not delete filters, only subsription. 

You can get all subscriptions with this one:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.subscription.FilterSubscription
import com.atlassian.jira.issue.subscription.SubscriptionManager

StringBuilder result = new StringBuilder();
SubscriptionManager subscriptionManager = ComponentAccessor.getSubscriptionManager();
for(FilterSubscription subscription: subscriptionManager.getAllFilterSubscriptions()){
    result.append("{ " + subscription.getLastRunTime().toString() + " / " + subscription.getFilterId() + " }")
}

return result.toString()
Tayyab Bashir Feb 04, 2016

JIRA Version: 6.0

Gave error when I tried to run the script.

Tayyab Bashir Feb 04, 2016

Capture.PNG

JIRA Version: 6.0

Gave error when I tried to run the script.

Vasiliy Zverev Feb 04, 2016

Hm, this code will work only 6.2+.

Since try this SQL to get all subscriptions:

Select
    filtersubscription.*
    , searchrequest.*
from
    filtersubscription
    left join   searchrequest   on  filtersubscription.FILTER_I_D = searchrequest.ID
0 votes
Koen Gillard Jun 08, 2018

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

736 views 7 0
Join discussion

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