Hi All,
Could you please let me know if it is possible to add group as default watcher?
Below is my code , However I am getting the below error
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.watchers.WatcherManager
import com.atlassian.jira.user.util.GroupManager
import com.atlassian.crowd.embedded.api.Group
import com.atlassian.jira.security.groups.GroupManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.bc.group.search.GroupPickerSearchServiceImpl
import java.lang.String
WatcherManager watcherManager = ComponentAccessor.getWatcherManager()
GroupManager groupManager = ComponentAccessor.getGroupManager()
def watchUsers = {groupnames ->;
groupnames.each {
watcherManager.startWatching(groupManager.getGroupByName((String)it), issue)
}
}
def grp = ["groupname"]
watchUsers(grp)
Groups cannot be watchers, so the call is failing because you're trying to give the function data it does not handle.
Hello @Shivani Chauhann
As @Nic Brough -Adaptavist- said it is not possible right now, so the only possible way is to add to watchers all users in groups, if this satisfy requirement.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.watchers.WatcherManager
import com.atlassian.jira.security.groups.GroupManager
WatcherManager watcherManager = ComponentAccessor.getWatcherManager()
GroupManager groupManager = ComponentAccessor.getGroupManager()
def watchUsers = {groupnames ->;
groupnames.each {
groupManager.getUsersInGroup(groupnames).each {
watcherManager.startWatching(it, issue)
}
}
}
def grp = ["groupname"]
watchUsers(grp)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Shivani Chauhan
As Nic already shared that it's currently not possible to add groups as watchers. Please vote here for this feature request
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.