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

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

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

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

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?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

795 views 5 7
Read article

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