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?
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alan Price
Ok, sounds a bit strange. How is your configuration for the script?
Can you supply a screenshot?
Regards
Lasse Langhorn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.