I am trying to automatically add watchers to certain issue types in a project on creation. Although the bug watcher plugin allows for a filter that would do this I can't enforce that users will create these filters. Thus I would like a script to do this at creation.
Adaptavist helped with a plugin that would do this but the plugin keeps getting in the way after about 4 different iterations.
I am running JIRA 7.x and this script should have worked
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue def watcherManager = ComponentAccessor.getWatcherManager() def userManager = ComponentAccessor.getUserManager() def users = ["admin", "anuser"] //user keys of users you want to start watching the issue Issue issue = issue users.each { userKey -> def userToWatch = userManager.getUserByKey(userKey) if (userToWatch) watcherManager.startWatching(userToWatch, issue) else log.warn "User with key ${userKey} is ot a valid user" }
It was erroring out probably because of some hooks the issue watcher custom field from Bug watchers notification plugin was causing.
Does anyone have a suggestion on how I can get around this?
You're right... the script should work. Maybe provide the errors being thrown by the Bug Watchers Notification plugin? That may suggest a workaround.
Hi Pat!
We are using for your case two different plugins: JIRA Watcher Field and JIRA Suite Utilities. They both are free. First allows create a custom field of users type which is connected with Watchers. The second one allows automaticly update custom fields and also this field. So user is added to the watchers on creation transition in the workfow you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have both of those plugins and life would probably be easy for me if it wasn't for the Bug watcher notification plugin which is making the watchers part of most scripting behave differently. I'm certain if I wasn't using this plugin that I could get the script to work.
Thank you for your answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That appears to be what is happening. NOTE: The bug watcher program allows individuals the ability to set a filter and become a watcher when any ticket with a certain criteria is created. If I could get my end users to do as I ask I wouldn't need to do it in the workflow with this plugin however the plugin does appear to be giving me issues when I try to program the action in a transition.
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.