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-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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