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.
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.
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)
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.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Atlas Camp is our developer event which will take place in Barcelona, Spain from the 6th -7th of September . This is a great opportunity to meet other developers and get n...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs