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
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)
					
				
			
			
			
				
			
			
			
			
			
			
		You'll need some code to do that.
As usual, I'd reach for the script runner plugin and writing a post-function script...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
 
 
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.