Use ScriptRunner to Present Users with a Custom Message Upon Ticket Creation

March 13, 2019

In my experience, when a user files a ticket on JIRA, they then proceed to message you on Slack, send you an email, or walk-up to your cube to say "Okay, I filed this ticket for you."  This is very unnecessary as we get notified immediately (upon ticket creation) via email and Slack.  In order to prevent this from happening, we're going to use ScriptRunner by Adaptavist to present the user with a 'thank you' message.  Here's how to set that up!

  • Jira (on prem) 7.13.1
  • ScriptRunner 5.4.48

First, browse to your ScriptRunner console by navigating to JIRA, clicking on the gear (top right of page), selecting Add-ons, and clicking on Script Listeners under SCRIPTRUNNER.  Once on the Listeners page, click on Add New Item and then select Custom listener.

JIRA: Add-ons > ScriptRunner > Script Listeners > Add New Item

Let's give it a name, select the projects that we wish for it to be used with, the relevant events, and the inline script which contains our custom message.  For this example, whenever someone opens a ticket within the Help Desk project, they will be presented with the custom message.  Once done, click Add.

import com.onresolve.scriptrunner.runner.util.UserMessageUtil
UserMessageUtil.success("Thank you for your ticket!  The DevOps team has been notified via email and Slack.")
JIRA: Add-ons > ScriptRunner > Script Listeners > Add New Item > Custom Listener

Go ahead and try it out!  You should see your custom message appear as a notification in the top right of the screen.  Here's what ours looks like:

JIRA: New Ticket Submitted > ScriptRunner Listener Activated

©2024 Tyler Wright