Listeners

What are Listeners?

A listener is an automated procedure or function in ScriptRunner that waits (or listens) for a specific event to occur in Jira and then carries out an action if the event occurs. Listeners sit on your instance and wait for an event to happen before executing the listener script. ScriptRunner for Jira includes several built-in listener options, as well as the ability to create your own completely custom listeners using Groovy. 

How to use Listeners

You may want to use a listener to:

  • Send an email or notification to a list of emails or all the users defined in a user picker field when the issue is commented on.
  • Transition an issue to another status when it is assigned to a user who is a member of the Developers role using the Issue Assigned event.
  • Automatically update fields for an existing issue when a user edits a specific value for a related field using the Issue Updated event.

On paper, ScriptRunner listeners and post functions seem similar; however, listeners allow you more control over automated actions than you would get with a post function. For example, whenever there is a Critical level priority issue in a certain project, you want a message to be sent to a Slack channel. If you use a post function to do this, an event would fire only after a transition, not if the issue is edited. Therefore, if the priority of the issue was edited to Critical the post function would not catch it until after the issue had been transitioned. To achieve this use case, you would use a listener to catch a change in priority when it happened. 

Before you Start

See our Using Listeners in ScriptRunner training module to learn about setting up and using listeners.


Broaden your horizons by exploring the Adaptavist Library for custom listener examples.