ScriptRunner script listeners run a script when they are triggered by one or morewebhook 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 toScriptRunner → Script Listeners.
ClickCreate Script Listener.
Enter the name of the listener inScript Listener Called.
Select the event(s) you wish the listener script to trigger on inOn These Events, for example,Issue Updated.
Select the projects you want the listener to be active for; you can selectAll Projectsor 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 inAs This User. SeeAs This Userfor more information.
Enter a condition on which the code will run. SeeEvaluate Conditionfor more information.
Write your script in theCode to Runfield. This code is executed when theEvaluate Conditionis true. Click on the examples under the code field for common use cases that can be edited to suit needs.
SeeExamplesfor use cases.
ClickSave.
Edit a Script Listener
Navigate toScriptRunner → Script Listeners. A list of all listeners is shown.
ClickEdit Script Listeneron the listener you wish to edit.