Can we make a particular user as default watcher when creating a issue. i saw some workarounds for this

  1. Add project role/group for notification scheme
  2. Add Distributed list for project lead

Anyway these workarounds only sends the notifications, but will not update the watcher field with the user, Is there any possibility of doing that ?

1 answer

1 accepted

JIRA applications don't have this feature natively, but you can do it as below:
  1. Install the JIRA Watcher Field Plugin

  2. Under Administration > Issues > Fields > Custom Fields, create a new field:
    1. Type = Watcher Field, Name = Watchers, Description = (eg) "Watchers are notified on issue changes", Search template = Watcher Search, Issue Type = Any, Context =Global
  3. Click the screens link for the new field and add it to the appropriate screen associated with issue creation.
  4. In the Administration > Issues > Screens section, you can set the position of the watchers field for screens you have added it to.
  5. Perform a re-index.

We don't  want to select the user we have a specific user, can we set this automatically when we create an issue

You need the script runner plugin:

Add the following groovy script:

 

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 = ["comma", "separated", "usernames"]
      watchUsers(users)

Hi ,

Thanks for the script.

i am getting error on the line 5 for this

->   any thing to be replaced for this ?

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

667 views 4 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot