Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add or removing watchers automatically after a workflow step/during transition

Simon Hönscheid September 17, 2014

We want to add or remove watchers automatically during a workflow transition, per person or all persons belonging to a group. Any ideas how to do that?

JIRA version is up to date.

 

Thx

Simon 

2 answers

0 votes
Simon Hönscheid September 17, 2014

I have found this one, but it does not work:

 

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)
0 votes
Nic Brough -Adaptavist-
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.
September 17, 2014

You'll need some code to do that.

As usual, I'd reach for the script runner plugin and writing a post-function script...

Suggest an answer

Log in or Sign up to answer