How to get the array of issue watcher?

in my plugin i want to write a methode that enables me to return the array of issue watcher

i want to know if it is possible to get the array of watcher

if yes, i hope if somebody could help me with this

thanks in advance,

3 answers

1 accepted

import com.atlassian.jira.issue.watchers.WatcherManager;

WatcherManager wm = ComponentAccessor.getWatcherManager();
List<String> watchers=wm.getCurrentWatcherUsernames(issue);

check this doc

https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/watchers/WatcherManager.html

excuse me rambanam but i want to have a coolection of users as this :

List<User> watchers;

How about this:

import com.atlassian.jira.issue.watchers.WatcherManager;
import java.util.Locale;

WatcherManager wm = ComponentAccessor.getWatcherManager();
Collection&lt;User&gt; watchers = wm.getCurrentWatchList(issue, Locale.ENGLISH);

excuse me rambanam but i want to have a coolection of users as this :

List<User> watchers;

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

161 views 1 17
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you