Can JIRA's autowatch be disabled?

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.

12 answers

1 accepted

This widget could not be displayed.

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.

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

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.

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.

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")

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.

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.

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

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).

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.

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)
}

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.

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.

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.

Thanks Nic for feedback!

This widget could not be displayed.

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)   
  }
}

This widget could not be displayed.

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.

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.

This widget could not be displayed.

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);
}
}

}

This widget could not be displayed.
Andrew Lui Atlassian Team Dec 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

This widget could not be displayed.

Hi,

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

Regards,

This widget could not be displayed.

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

This widget could not be displayed.

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
This widget could not be displayed.

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!

This widget could not be displayed.

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

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.

Have you created any plugin in jira??

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)

This widget could not be displayed.

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.

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted 2 hours ago in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

11 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you