Heads up! ScriptRunner for Bamboo documentation has moved to https://docs.adaptavist.com/sr4bam. Adaptavist will keep this site up for a bit, but no future updates to documentation will be published here. ScriptRunner 6.20.0 will be the last release to link to scriptrunner.adaptavist.com for in-app help.

Jobs in ScriptRunner allow you to script actions to run automatically at a specified time interval. We use crontab syntax to schedule tasks. You can access jobs by clicking Administration > Add-Ons.

In the menu bar on the left hand side under the ScriptRunner heading, click Jobs to see your options.


Basic Job Usage

Add a Custom Job

A custom job allows your own script to run at a timed interval. Follow these steps to set one up:

  1. Click Add New Item to reveal a list of the jobs you can create.

  2. Click Custom Scheduled Job from the list that appears.

  3. Populate the form as appropriate to your use case.

    Field Description


    The user that the script should run as.


    A reference that describes what your job is doing. This text is visible in the job list.


    You can add either an inline script or reference to a script that exists in your script root. This is the action that you want to be done at a scheduled interval.

    Cron Expression

    There are built-in examples of cron expressions that you can put in by clicking the Expand Examples menu.

  4. Once the form is complete, save the job by clicking the Add button.

    The job is not active until you click Add.
Click Run Now at any time to test your script.

Once the save is complete, the job appears in the list of jobs in the main menu.


Edit a Job

To make a change to a job that already exists, follow these steps:

  1. Click the Actions menu for the job that you wish to edit.

  2. Click Edit from the menu that is presented.

Delete a Job

To remove a job that you no longer require, follow these steps:

  1. Click the Actions menu for the job that you wish to edit.

  2. Click Delete from the menu that is presented.

The Build SLA Reminder Job

In this example, use a job to regularly add a comment to all build plans that are currently failing. For example, check for builds that have been in a failing state for more than one day.

Then, configure Bamboo build plan notifications so that when the comment is added, a notification is then sent to Slack.

Adding the Job

  1. Navigate to the Jobs page.

  2. Select Add New Item and then Build SLA Reminder.

  3. Fill in the details as shown:

    failed builds scripted job
    Make sure to use whichever user you plan to run this job as, rather than Admin. The Cron Expression in this case means "Run at half past midnight every day".

Once the job has been saved, you should start to see comments like the following screenshot start appearing on failing build plans.

failed build comment

Configuring the Bamboo Notifications

Now that the job is monitoring the failing builds and commenting on those that have not been fixed within a specified amount of time (one day in this example), the relevant build plan notification settings can be configured.

  1. Enter Event as Comment Added.

  2. Enter Recipient Type as Slack.

  3. Obatin the Slack Webhook URL from your Slack administrator.

  4. Enter the Room Name as the name or ID of the Slack channel you wish the notifications to appear in.

slack notification config
The Comment Added notification type is only available at the project plan level. Configure this notification for each of the project plans you are interested in.

Once the above Slack notification is configured, you should now start receiving Slack notifications like the following:

The slack notification:

slack notification result

Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.

Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.

Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.