Remove user from watchers in post function or listener Edited

Hello,

In workflow create action I have post function which adds specific user to watcher list (service user). Goal is to enable sending email notifications about created issue to group of people (mailing list).  I wanted to first add this service user as a watcher and than after email notification is sent remove the user from watcher in order to avoid receiving spam.

The problem is that I can't force JIRA to remove user from watchers in post function (after firing JIRA issue created event) or in script listener (event Issue Created). stopWatching(user, issue) function just doesn't work. Moreover getWatchersUnsorted(issue) function gives me list of watchers (my service user is present in that list), but when I run isWatching(user, issue) method with my user it always returns false.

I also tried to programmatically reindex issue but this also didn't work.

Any ideas? Thanks,

1 answer

0 vote
Thomas Schlegel Community Champion May 10, 2017

Hi Eryk,

why don't you put them all in a self defined group and add the notification to that group in the notification scheme to the event "Issue Created"?

 

Hi Thomas,

Because I want to avoid managing those groups (new hires etc.) as an administrator.

Thomas Schlegel Community Champion May 10, 2017

but adding and removing users to/from the "add-and-remove-watchers-function" is also an administrative effort ;-)

You've got a point there :) But I also want to send those emails for specific issue types i.e. only Defects for one project, Story for another.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

165 views 0 2
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