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

2 votes
Accepted answer
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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,923 views 19 22
Read article

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