Script Runner custom listener - script won't run on Issue Closed or Resolved

Hi,

I need a custom script listener to run on the events "Issue Closed" or "Issue Resolved". However, I can't seem to get these to work. The execution log reads "Has not run yet" even after I open and close issues repeatedly. I can't even get the script to output a log.error.

I have several other listeners that run on "Issue Updated" or "Issue Commented" and work fine. I know the problem is with the event because when I change the exact same listener to "Issue Updated" everything works great. Unfortunately I only want this listener to send an email once when it is closed, not every time the issue is updated leading to many emails.

If this is a known issue or you suspect what the problem is please assist. Here is the code used to initialize the issue:

String issueKey = event.issue
IssueManager issueManager = ComponentAccessor.getIssueManager()
Issue issue = issueManager.getIssueObject(issueKey)

Thanks,

Kevin

1 answer

1 accepted

1 votes

You need to check that your workflow actually fires those events. That happens in the default workflow, but if you create one from scratch it doesn't necessarily include those events. Just setting a resolution, or transitioning to a status called "Closed", won't fire either of those events in of itself. Compare with the so-called "classic" workflow.

Thank you sir. Was not aware of this on custom workflows.

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

239 views 0 11
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot