Hey Rita
You can create a custom listener, assign it to listen for issue create events and in the inline script
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.security.roles.ProjectRoleManager Issue issue = event.issue def watcherManager = ComponentAccessor.getWatcherManager() def projectRoleManager =ComponentAccessor.getComponent(ProjectRoleManager) def developersProjectRole = projectRoleManager.getProjectRole("Developers") def actorsInRole = projectRoleManager.getProjectRoleActors(developersProjectRole, issue.getProjectObject()) actorsInRole.getApplicationUsers().each {user -> watcherManager.startWatching(user, issue) }
For more information have a look in WatcherManager and ProjectRoleManager
PS. Is tested in a JIRA v7.1 , I don't expect to be different in a 6.* JIRA version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rita,
Apologies for not getting back to you sooner but I have been busy with other items this week.
I have tested the code that my colleague Thanos has provided below and can confirm that this is the solution that you should use.
I have enclosed some steps below on how you can add this as listener into JIRA.
I hope this helps.
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jamie Echlin (Adaptavist) I want to write a script that only some groups have this features.
do you have any idea on how to do it through script runner?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is a build-in feature. No plugin needed. Just add a new role in System Administration in section Security - Roles, add a new role, e.g. "Global Watcher". Then in your project's Notification Scheme add this role to all notifications you need.
Sorry, this does not make them "issue-watchers" (not added to issue field value Watchers for each issue), they just receive all email, which may be what you want or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rita,
I think you may find the Add Watcher listener provided by ScriptRunner will be useful to resolve this requirement.
The official documentation on the Add Watcher listener can be viewed here.
I hope this helps
Thanks
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kristian Walker (Adaptavist) in fact I want to use the project role instead of the current user. I dont know how to do it using the listener
awaiting your advise.
Thanks
Rita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What have you got so far?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.