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.

Switch User

The Switch User built-in script allows administrator users to temporarily assume the identity of another user. Switch User has a variety of uses, such as:

  • Reproducing and troubleshooting problems specific to a user to diagnose permissions issues.

  • Updating an issue on behalf of another user if they are unavailable.

To switch back to your original user, click the Return to session as link in the Switch User banner.

switch user banner

Configuration Exporter

Use the Configuration Exporter built-in script to export extension configuration information to a descriptor (YAML) file. The YAML file contains information required to configure built-in extension points such as listeners, hooks, macros, and UI fragments, etc.

Using this file within Script Plugins when migrating from one instance to another, allows scripts to be automatically configured, saving time and ensuring consistency across instances.

  1. To create the YAML file, first navigate to Built-in Scripts > Configuration Exporter from ScriptRunner.

  2. Items with configurations available for export are shown in the Export What field. Select the items you wish to generate the YAML for. Multiple items can be exported to one YAML file.

    config-exporter

    The Note field is used to distinguish one item from another, only items with notes are shown. Ensure the Note field has a value for all configuration items you wish to export.
  3. Click Run to generate the YAML snippet. Copy the snippet and paste it into your scriptrunner.yaml file.

    You can manually edit the code yourself to add more items, though it’s generally easier to re-generate the YAML file using the Configuration Exporter script.

List Scheduled Jobs

Use the List Scheduled Jobs built-in script to view details of all scheduled jobs on the current instance.

Results show the Job ID, Interval, Next Run, and Run Mode of each job, listed below the feature under which they run.

To use this script, you need to click Run.

View Server Log Files

Use View Server Log Files to see the last N number of lines of the desired server log.

This built-in script allows users to check log files without the need to connect to and have access to the server.

Clear Groovy Class Loader

Use Clear Groovy Caches to manually clear caches if automated clearing fails. Automation should reload classes whenever a script is modified; however, dependent classes can fail to reload.

There are no fields for this built-in script. You just have to select Run or Preview. After you run this script, expect a delay in screen refresh because classes are recompiled when clearing caches.

Example Scenario

If you have a custom class file (ClassA) in your script roots and another Groovy script imports that file, modifications to ClassA may not show up until you modify the script that imports them or clear the Groovy cache with this script.

Test Runner

Do not run this built-in script in a production instance as you may suffer irretrievable data loss.

Use Test Runner to run JUnit and Spock tests in a development instance only. Follow these steps to run the built-in script:

  1. Enter the list of packages to scan for tests in Packages.

  2. Enter tests to run in Tests.

  3. Click Run to execute the script or click Preview to view changes before implementing them.

    Once you select Run, the Results of the script appear.

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.