Forums

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

Using listeners for issueWatcherDeletedEvent

Alan Price May 7, 2020

Hi, I'm trying to create a listener which will send an email when the number of watchers goes to zero. While I can get it to work in the Preview, when I go live with it, I get an error:

2020-05-07 13:41:26,074 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2020-05-07 13:41:26,074 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueWatcherDeletedEvent, script: com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.SendCustomEmail
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.atlassian.jira.event.issue.IssueWatcherDeletedEvent@177e124f' with class 'com.atlassian.jira.event.issue.IssueWatcherDeletedEvent' to class 'com.atlassian.jira.event.issue.IssueEvent'

This happens even if I comment out all the script, so it appears to be an issue with the event itself. Any thoughts or ideas for what I could try?

1 answer

0 votes
Lasse Langhorn
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.
May 8, 2020

Hi @Alan Price 

Have you tried something like this:

package dk.langhornweb

import com.atlassian.jira.event.issue.IssueWatcherDeletedEvent

def event = event as IssueWatcherDeletedEvent
if (event?.applicationUser) {
// Do something with event and the user
}

Regards

Lasse Langhorn

Alan Price May 11, 2020

Thanks for the reply - I see where you are going with this, however I'm getting the error with the conditon script commented out - which suggests its not the script thats the problem. Running the listener in preview works ok, if I run it after coming out of preview it fails. regardless of whether the condition script is active or commented out.

Lasse Langhorn
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.
May 11, 2020

Hi @Alan Price

Ok, sounds a bit strange. How is your configuration for the script?
Can you supply a screenshot?

Regards

Lasse Langhorn

Alan Price May 11, 2020

Untitled.pngOk here it is - but as you can see the script is commented out. This is the 'send custom email' listener but I also tried the same event in 'fires an event when condition is true' and that does the same - I think this is a Jira bug.

Lasse Langhorn
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.
May 11, 2020

Hi @Alan Price

It looks fine to me so you might be right about a possible bug.

Have you tried to delete the listener and then create it from scratch again?

Regards

Lasse Langhorn

Alan Price May 11, 2020

Hi - yes - thats basically what I did by creating the second one. I'm going to have a look at the release notes to see if there is anything there. We are on 7.13 so there hae been a few fixes since then.

Suggest an answer

Log in or Sign up to answer