Can JIRA's autowatch be disabled?

Mike Curwen NL May 10, 2012

The new 'Autowatch' feature in version 5.0.3 of JIRA is enabled for everyone by default. We've so far set up our projects and notifications in such a way that having the reporter auto-watch their created issues will be unacceptable. [1]

Is there a setting that can disable this feature site-wide?

[1] the reason is: we auto-create issues by email and set the reporter field, but our notifications do NOT email the reporter (we use JIRA behind-the-scenes). We use the watcher field to add people like Analysts, Devs, Ops people, etc, and so 'Watchers' is on most notifications. As far as our users know, they email "Help Desk" and further communication is via email with a real person (not a JIRA system). With reporters being auto-watched, we're hooped I think.

13 answers

1 accepted

4 votes
Answer accepted
JamieA
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.
May 10, 2012

It's a bit of an oversight that they have not made this disable-able, imho. It's not even a plugin module so you can't disable it.

If you can't recompile a class, you may have to rethink.

Mike Curwen NL May 10, 2012

darn, I was hoping it was a plugin. I don't currently have a staging env, so couldn't check. Thanks Jamie.

Norman Abramovitz
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.
May 10, 2012

You might need to resort to SQL and update the database once you figure out what records are created/updated when a user disables autowatch.

JamieA
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.
May 10, 2012

You could easily run a few lines of groovy to change the autowatch preference for users, but the problem is when new users join. I guess you could write a UserEvent listener which turns it off whenever someone signs up.

Mike Curwen NL May 10, 2012

Well, I'm sure there's those out there that would find it 'easy', but I'm not among them. ;) (It's mostly the JIRA API I just don't "get")

JamieA
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.
May 10, 2012

If you have script runner, the following lines pasted into the script admin panel will disable autowatching for all users:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.preferences.PreferenceKeys

def userManager = ComponentAccessor.getUserManager()
def preferencesManager = ComponentAccessor.getUserPreferencesManager()
userManager.getUsers().each {user ->
    preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true)    
}

You can also (relatively) easily set this up as a service to run every 20 mins or whatever.

Mike Curwen NL May 10, 2012

Thanks for that Jamie,

As I think of it more, the auto-watch *would* actually be handy for us back-end folks. I think I'll create an autowatchers group, assign the back-end people to that group, and then alter your script to check for the group membership (and only adjust people not in autowatchers).

Aside from a plugin, I was also hoping that it might be implemented as one of those built-in post functions that happens during workflow, that i could just remove. But then realized comments aren't workflow-able.

I'll have to dust of staging and give it a try.

JamieA
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.
May 11, 2012

No, it's implemented as a listener, but not the old style that you could just remove admin -> listeners.

Laszlo Kremer
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.
July 9, 2012

Preparing for upgrading JIRA to 5.0.7 i find this as a pitfall. Thank you Jamie for the groovy script, it creates the propertyentities and entries, so no unwanted emails will be sent.

Of course I was looking for a sql command, the data tables are:

* external_entities

* propertyentry

You probably have to insert the records for users, and reindex JIRA. I don't recommend doing this.

I choose to run Jamie's script, although it returned errors, it created all the entries for the users. And I didn't have to reindex JIRA.

I have to change it or find another solution for new users until we figure out how to modify the notification schemes to fit in the situation and re-enable this feature (which is very good I think).

Laszlo Kremer
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.
July 15, 2012

Sorry, and the value is stored in here:

* propertynumber

one note about the script: it is not working if no one changed the Autowatch property.

Per Sundstedt January 19, 2014

Jamie,

is there a way to use your solution and only use it for one project (and the users in that project) not all users for all projects?

Thanks for reply!

/Per

--

If you have script runner, the following lines pasted into the script admin panel will disable autowatching for all users:

1
2
3
4
5
6
7
8
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.preferences.PreferenceKeys
def userManager = ComponentAccessor.getUserManager()
def preferencesManager = ComponentAccessor.getUserPreferencesManager()
userManager.getUsers().each {user ->
preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true)
}
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 19, 2014

Autowatch is a user setting, not a project one. There's no relationship between projects and watching - you either have autowatch enabled on your account or you do not.

Per Sundstedt January 19, 2014

Hi Nic, thanks for reply, yes I was in the wrong end to configure this, got it now.

If you have many users, how to work with this efficient? (if some want to still use autowatch and say 100 want to disable). Does every user have do disable it?
The solution Jamie gave will impact all users in all projects.

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 19, 2014

Decide on the default setting for the majority of your users first, and set that.

Then, yes, ask the users to set their individual preference if they don't like the default. There's no tieing it to project membership.

Per Sundstedt January 19, 2014

Thanks Nic for feedback!

4 votes
HermannS August 8, 2012

I had the very same problem and tried the direct DB-access route but with no success.

So I installed the Script Runner plugin and used the groovy script of Jamie (thanks for that, Jamie!). It works really well, but I recommend a small change to it: Add a check if autowatch isn't disabled already. This change makes it run almost twice as fast (slightly more than a minute compared to two minutes for my 42.000 users installation):

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.preferences.PreferenceKeys
 
def userManager = ComponentAccessor.getUserManager()
def preferencesManager = ComponentAccessor.getUserPreferencesManager()
userManager.getUsers().each {
  user ->
  if (! preferencesManager.getPreferences(user).getBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED)) {
    preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true)   
  }
}

2 votes
Andrew
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 11, 2012

Hi,

You can now configure autowatch for all users in JIRA 5.2.2. More details in the release notes:

https://confluence.atlassian.com/display/JIRA/JIRA+5.2.2+Release+Notes

Kind Regards,
Andrew

2 votes
SuhailM July 2, 2012

You can disable by wrtiting a service.here is the code-


private void deactivateAutoWatch() {
UserManager userManager = ComponentAccessor.getUserManager();
UserPreferencesManager preferencesManager = ComponentAccessor.getUserPreferencesManager();
Collection<User> allUsers = userManager.getUsers();
for (User user : allUsers) {
try {
preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true);
} catch (AtlassianCoreException e) {
log.error("AutoWatchDisableService Error:" + e);
}
}

}

2 votes
Ramiro Pointis
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.
May 10, 2012

Hi Mike, here I found some documentation about how to disable the autowatch tool:

http://confluence.atlassian.com/display/JIRA/JIRA+5.0.3+Release+Notes#JIRA503ReleaseNotes-Autowatchissuesyoucreateorcommenton

I believe there isn't a way to change it by default, you should go to every user profile and change the option.

Mike Curwen NL May 10, 2012

Not gonna happen, I have over 300 profiles, to which I don't have the password. And I don't want them to change it back either. I need a way to disable autowatch entirely, or I'll have to rethink and redo our usage of reporter field, watcher field, and notification schemes.

1 vote
Christoph Leithner August 19, 2015

Auto watch can be configured in the JIRA UI

  • for all users in JIRA Administration under System -> User Default Settings -> Autowatch own issues
  • for each user individually in the user profile
1 vote
carlitos.melgar@izote.net July 2, 2012

Anybody have a clue on where this can be updated via SQL?

1 vote
SuhailM June 12, 2012

Hi,

Do you have any idea in which JIRA Database table this is stored??

Regards,

0 votes
Priscila Vega May 30, 2019

Hi @JamieA ,

Is there a way to set all users autowatch preference to "Inherit from global settings" using scriptrunner? 

Thanks in advance!

0 votes
Per Sundstedt January 19, 2014

Hi Jamie,

regarding your solution about autowatch disabled, is there anyway to use this solution on one project? (that this rule will not change for alla projects) ?

--

If you have script runner, the following lines pasted into the script admin panel will disable autowatching for all users:

1
2
3
4
5
6
7
8
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.preferences.PreferenceKeys
def userManager = ComponentAccessor.getUserManager()
def preferencesManager = ComponentAccessor.getUserPreferencesManager()
userManager.getUsers().each {user ->
preferencesManager.getPreferences(user).setBoolean(PreferenceKeys.USER_AUTOWATCH_DISABLED, true)
}
--
Thanks for quick reply!
/Per Sundstedt
0 votes
Daniel Varela Santoalla June 11, 2013

In our case what we would need is to have autowatch enable or disabled per-project. In some cases we would like it happening but we do have some others projects that we want to handle as Mike Curwen says, in a "JIRA behind-the-scenes" mode.

To just enable or disable for the whole instance is a bit of a shotgun approach, in my view.

0 votes
carlitos.melgar@izote.net July 2, 2012

Really appreciate the code!!! I understand what it does. However, I do apologize as I'm just know .Net and have no idea how to write a service for Jira. Could you help me with some tips?

I found this on google: http://www.j-tricks.com/1/post/2010/11/jira-service.html But have no clue on how to setup Eclipse (I assume) and all the other stuff needed to create a service for Jira.

Any help will greatly be appreciated.

Thanks,

Carlos

carlitos.melgar@izote.net July 2, 2012

Unfortunately no. I'm only the user (administrator) of Jira for my office. Just upgraded from 5.0 to 5.0.6 and got into trouble by this autowatch feature. I'm sure it helps someone, but it sure sucks for my setup.

SuhailM July 2, 2012

Have you created any plugin in jira??

AlexanderR August 2, 2012

just set up the atlassian-sdk:
https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project

then do any plugin tutorial, e.g. https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Creating+a+Custom+Field+in+JIRA

that should get you started. (you will then know, that you just have to go into the directory with the pom-file, execute atlas-mvn eclipse:eclipse and import the project into eclipse)

0 votes
Mike Curwen NL June 18, 2012

I have found and voted for this issue: https://jira.atlassian.com/browse/JRA-28268

Please do the same, if you think this needs fixing!

Suggest an answer

Log in or Sign up to answer