Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner listener

Volodymyr
Contributor
October 19, 2021

Maybe someone can help me with the creation of a listener.
Can I create 1, 2 or 3 listeners to achieve the next goal?
A requester wants to receive emails for any update in tickets where he's not Reporter, Assignee or Watcher at the same time.

I still cannot find a solution to create right code for "Condition and Configuration".

1 answer

1 accepted

0 votes
Answer accepted
Ivan Lima
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2021

Hi @Volodymyr, What do you refer to by "Reporter, Assignee or Watcher at the same time"? For example, don't you want to send notifications beyond your notification schemes' settings if the user is the assignee only? Also, when you mention "Condition and Configuration", do you also want to capture events beyond issue updates? I know that a filter subscription won't send emails as soon as tickets get updated, but wouldn't that be somehow sufficient for your use case?

Volodymyr
Contributor
October 19, 2021

@Ivan Lima
Honestly I'm not sure about filter for this case.
A person has a project where there are a lot of tickets when he's not in: Reporter, Assignee or Watcher.

If he's in one of these fields (Reporter, Assignee, Watcher) he receives notifications with updated - that's fine.
But If he's not in the fields above, he also wants to receive notifications.

Please let me know if it's unclear now.

Volodymyr
Contributor
October 19, 2021

My solution is too complicated, so I settled on two choices:
1. Add a specific person to the watchers when a new issue is created.
2. To avoid the ocean of emails, this person will independently add himself to the watchers only in the necessary tickets.

Ivan Lima
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2021

It's clear. Thanks for clarifying it, @Volodymyr. I'm sure we can create a script to achieve that. We write tons of those scripts for our customers very often. However, I think it's worth exploring more straightforward solutions, when there is one, before jumping to the more complicated ones.

You can easily create a filter subscription, where a user will receive an email with the results of the filters. You can determine a schedule for it. Let's say once a day at 6:00 AM. Twice a day, etc. Your filter could look like this:

assignee != currentUser() AND reporter != currentUser() AND watcher != currentUser()

Once your users receive the results, they can decide which one they want to receive notifications and add themselves to the watcher list. You can also share a bit of the responsibility with users and educate them to actively look up for issues they want and need to watch.

I know you're specifically looking for a script, but as I said, I believe it's worth putting some thought on some out-of-the-box options before jumping to that. If none of that makes sense for your use case, I can help you with some scripting.

Volodymyr
Contributor
October 20, 2021

@Ivan Limathank you for such detailed clarification.
I thought about it, but the requester has decided the first option.

To be honest, initially I thought that the best way to do this is via a Listener and a "simple" script, but I'm bad at coding and the guy from my team wrote to me that it is better not to use a listener in this case - it complicates the issue and without knowledge of the code it will be difficult to troubleshoot.

Thank you again for the detailed and quick reply, I appreciate it.

Like Ivan Lima likes this

Suggest an answer

Log in or Sign up to answer