There are some scheduled Scriptrunner Jobs which run everyday, if it fails need to send email with details of failed job, how do we do it using Listeners or what is the right way to do it, there are many scheduled Jobs which need to be monitored and sent email when the executions have failed.
Could you please clarify what is the current version of Jira you are using?
I am asking for this to verify if the solution provided by @Sean Chua _Adaptavist_ is applicable to your environment.
Also, if the version of Jira you are using is 8.20 and above, it would be best to update your ScriptRunner plugin to the latest release so you can make use of ScriptRunner'S HAPI feature which can simplify the process of the email notification.
I am looking forward to your feedback and clarification.
Thank you and Kind regards,
Ram
Hey @anil musunuru , following on from what Peter said - what version of ScriptRunner are you on?
Execution failure notifier is a built-in script available from ScriptRunner for Jira Server/Data Center v8.5x onwards.
If you are using the right ScriptRunner version, you can find it in your "Listeners" tab, right at the top.
If you've upgraded to the latest ScriptRunner version, you can now get example scripts directly from the editor;
Examples;
If you don't have the latest version.. I've copied the script for you - maybe you can test this out;
import com.atlassian.mail.queue.SingleMailQueueItem
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.mail.Email
def email = new Email('user@email.com')
email.setSubject("Something has gone wrong in ${event.featureName}")
email.setBody("""
Notes: ${event.notes}.
Something has gone wrong in ${event.featureName}.
To edit this click here: ${event.url}
Error: ${event.stackTrace}
""")
SingleMailQueueItem item = new SingleMailQueueItem(email)
ComponentAccessor.getMailQueue().addItem(item)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sending the Code snippet, will try and let you know, i am using Scriptrunner version 6.49.0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried this:
One of the code examples includes how to send an email.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I’m using Jira Software and i dont see an option for Execution Failure Notifier.
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.