ScriptRunner script listeners run a script when they are triggered by one or more webhook events. Webhooks are fired after an action takes place in Jira, for example, when an issue is updated or a project is created.

For example, you can use a script listener to populate a project with initial issues when it is created. Script listeners can also be used to send notifications outside of the standard notification scheme.

Create a Script Listener

  1. Navigate to ScriptRunner → Script Listeners.

  2. Click Create Script Listener.

  3. Enter the name of the listener in Script Listener Called.

  4. Select the event(s) you wish the listener script to trigger on in On These Events, for example, Issue Updated.

  5. Select the projects you want the listener to be active for; you can select All Projects or a number of individual projects.

    Project settings only apply to issue, project, issuelink (source issue), version, and comment related events.

  6. Choose the user you wish to run the listener as in As This User. See As This User for more information.

  7. Enter a condition on which the code will run. See Evaluate Condition for more information.

  8. Write your script in the Code to Run field. This code is executed when the Evaluate Condition is true. Click on the examples under the code field for common use cases that can be edited to suit needs.

    See Examples for use cases.

  9. Click Save.

Edit a Script Listener

  1. Navigate to ScriptRunner → Script Listeners. A list of all listeners is shown.

  2. Click Edit Script Listener on the listener you wish to edit.

  3. When all changes have been made, click Save.