Built-In Listeners

Many of the post-functions are also available as listeners. This lets you have better control over your business processes. As an example, let’s say you need a cloned issue created in a different project whenever a Critical priority issue is raised.

Although you can put the Clones an issue and links post-function on an event, if the issue is created as Major priority then subsequently edited and changed to Critical, a workflow function won’t catch it. This is where listeners come in.

Listeners are accessed in the admin UI (find the Admin cog and then Add-ons), under the ScriptRunner section and Script Listeners. In addition to the settings available when installed as workflow functions, you can also specify which events and which projects are applicable.

You can filter on projects using the Condition field as well, however as projects are much more likely to be used with listeners this is made more explicit here.

If you need to filter on issue type you can do that in the condition field, eg:

groovy
issue.issueTypeObject.name == "Bug" // && any other conditions

Example Conditions are supplied which you can use as templates.

You can add multiple configurations for the same type of listener if they have different parameters.

The listeners are not documented here as they have the same functionality as their workflow function counterparts. The listeners currently available are: