I am just looking for a way to ensure that whoever is or was assignee for an issue should automatically get added as watcher to that issue (even if he/she hasn't commented).
I was just going through script runner functionality and i think we could achieve it using script runner listener, but i am not an expert in listeners, so i would seek your help here.
There is also a functionality there which helps to add any current user as watcher but i don't need that as that will be mess up our watchers list.
Any help/suggestions here will be greatly appreciated as always.
Cheers,
Ashley
You could use the following as a listener on the Assigned event:
import com.atlassian.jira.component.ComponentAccessor def watcherManager = ComponentAccessor.getWatcherManager() watcherManager.startWatching(issue.assignee, event.issue)
untested, and that's for 7.0. In 6.x you may need to convert the user from one type to another, or use issue.assigneeUser or something.
Thanks Jamie for the prompt response :) I just copied this and pasted inside the Script runner->Script Listeners->Custom Listener and configured it for Issue Assigned Event for a project. But the issues in that project are not at all impacted by this listener. I am a novice in Listeners so i don't know what exactly should be the code. Any help here would be greatly appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just made changes with respect to issue.assigneeUser instead of issue.assignee and it works for issue assigned event. But i also need this to work when users are assigned issues via workflow transition post functions, so i also added Generic Event to the listener(since my workflow transitions fire Generic Event) and that too works fine. Can we do the same for Reporter, so what should be the modified code:- import com.atlassian.jira.component.ComponentAccessor def watcherManager = ComponentAccessor.getWatcherManager() watcherManager.startWatching(issue.assigneeUser, event.issue) watcherManager.startWatching(issue.reporterUser, event.issue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
good guess ashley watcherManager.startWatching(issue.reporterUser, event.issue) will do the trick for the reporter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to be a bit careful that the assignee is not null, so I would surround it with: if (issue.assigneeUser) { ... }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the need for automatically adding them as Watchers? Is it for Notifications? Alternatively, you can just add "Assignee" in the Notification scheme.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thats not the solution because jira only sends notifications to current assignee not to any other assignee of the past (if he has not commented and is in someway not a watcher)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is a global/personal configuration to Autowatch issues you were assigned to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Or else if you can help me write appropriate condition in the script runner ->script listeners under Adds the user performing the action as a watcher, if condition applies... then that should be ok with me. But then this should ensure that any user who was assignee to that issue at some point of time should be the watcher to the issue.
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.