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 set automatic watchers to all isues created in the project?

How can I set automatic watchers (one or more) to all isues created in the project? I need it for JiraConnect push notifications.

5 answers

1 accepted

5 votes
Answer accepted

I found the solution. I edit the workflow (diagram) post function in "Create issue" and add Script Post-Function - there URL: /YOUR_URL/atlassian/jira/atlassian-jira/WEB-INF/scripts/groovy/autwatcher.groovy and there I upload file (groovy script) which contains:

import com.atlassian.jira.ComponentManager

def componentManager = ComponentManager.getInstance()
def watcherManager = componentManager.getWatcherManager()
def userManager = componentManager.getUserUtil()

def watchUsers = {usernames ->
usernames.each {
def user = userManager.getUser(it)
watcherManager.startWatching(user, issue.getGenericValue())

def users = ["USERNAME"]

And it works :)

I get below error when i tried to add custom script Post function

2018-07-27 17:48:18,320 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2018-07-27 17:48:18,331 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: null, actionId: 1, file: <inline script>
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.ComponentManager.getWatcherManager() is applicable for argument types: () values: []

I read about JIRA Component Watcher but it is now: 503 Service Temporarily Unavailable. Is it something like that what is proper?

can we add roles as watchers in groovy scripts when an issue is created

You could add an Update issues post function to the create issue transition workflow. The general technique is describe here: How to update issues after initial issue create . Watchers is one of the things that can be set or added to.

I don't see how post function can be used for this purpose - there are only 2 choises: Update Issue Status and Update Issue Field, and non of them can be used to add watchers to an issue.

Could you tell me, how to do that?

This is an excellent question Dilyara, have you figured it out?

Have a look at the links Bob gave.

I just added Component Watcher plugin and added components to the project 

This plugin is useless for the intended purpose of this thread (i.e.: How to set automatic watchers to all issues created in the project?). In this plugin, you must select all components that the watch will apply to... so if a new component is created, and a Jira issue raised for this new component, the watch will not be applied to it.

If the plugin had the option 'all components' it would be a different matter.

May be you should try to ajust notification scheme in the project?
I chose the option of notifying some users when issue is created and updated and it works perfect. 

/plugins/servlet/project-config/*your project's ID*/notifications

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Desk

Tell us how you've implemented Change Management

Hello Community 👋, I'm a product manager at Atlassian, looking at improving change management capabilities across our products. In particular, we're looking at bridging the gap between Dev & ...

1,888 views 10 17
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