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
Navigate to Admin > Listeners.
Select the Add New Item button to expand the listeners available to create.
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:
Select Custom Listener.
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 both
BuildCompletedEvent
andBuildDeletedEvent
: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.