ScriptRunner for Bamboo is retiring!

ScriptRunner for Bamboo will be retired on 8th December 2022.

If you have any questions, please visit Adaptavist Product Support.

Listeners

Using Listeners in ScriptRunner for Bamboo, you can perform custom actions whenever standard Bamboo system events are fired. There are built-in listeners, or you can create a custom listener.

Adding a Listener

  1. Navigate to Admin > Listeners.

  2. Select the Add New Item button to expand the listeners available to create.

  3. Choose a Custom Listener or a built-in listener.

Custom Listeners

You can create custom listeners with your own scripts. To add a custom listener, follow these steps:

  1. Select Custom Listener.
    custom event handler form

  2. In the Events field, select the events you want to listen for.

    The event is contained in the script binding. The event object has the type corresponding to its name. For example, if you are listening for BuildCompletedEvent you get a BuildCompletedEvent object.

    You may choose to have your listener look for multiple events. If you need to do different things depending on the type of event, you can check that with instanceof.

    Alternatively, you can type your event to the most specific superclass. In in the above example that would be BuildEvent.

    For example, to get the page content for bothBuildCompletedEventandBuildDeletedEvent:

    groovy
    def event = event as BuildEvent def content = event.content.bodyAsString

    In the first line, the event is passed in the binding. This line is only used to give type information when using an IDE, and has no functional impact.

On this page