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
Navigate to ScriptRunner → Script Listeners.
Click Create Script Listener.
Enter the name of the listener in Script Listener Called.
Select the event(s) you wish the listener script to trigger on in On These Events, for example, Issue Updated.
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.
Choose the user you wish to run the listener as in As This User. See As This User for more information.
Enter a condition on which the code will run. See Evaluate Condition for more information.
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.
Edit a Script Listener
Navigate to ScriptRunner → Script Listeners. A list of all listeners is shown.
Click Edit Script Listener on the listener you wish to edit.
When all changes have been made, click Save.