The Adaptavist Group LogoDocumentation

Script Console

Learn how to run one-off scripts, experiment with Jira APIs, and save, edit, and delete console scripts with full execution history.

You can use the script console to:

  • Display or export information.
  • Run one-off maintenance or clean-up tasks.
  • Bulk update work items, spaces, users, versions, and more.

You can also save console scripts for future use. Each saved script keeps activity history for tracking and review. This is especially useful when you want to run ad-hoc tasks without creating a scheduled job.

Output and logging

When you run a script from the script console, the output panel shows:

  • Anything logged with console.log(...).
  • The final value returned by your script with return.
  • The error, if the script failed, with the full untrimmed error behind Full error.

Use console.log(...) for messages, intermediate values, or debugging, and include a return statement for the main result you want to display.

Activity history

To track how a script behaves, save it. Saved scripts keep activity history, so you can review when they were run, who ran them, and what the output was, making it easier to audit, troubleshoot, and confirm routine tasks. For how long activity is kept, see Run history retention.

Test a script in the script console

You can run a script in the script console without saving it, to check that it does what you expect. To test a script:

  1. In Jira administration, select Marketplace apps.
  2. Under Apps, select ScriptRunner.
  3. Select Script console.
  4. Choose who you want the script to Run as: the current user, ScriptRunner app permissions, or a specific user. The default is the current user.
  5. Write your script.
    Tip: To help you write scripts, you can use the script console examples provided, use HAPI, or select Example scripts directly in the script editor.
  6. Select Test script.

    A testing panel displays.

  7. Select Run.

    The panel shows anything logged with console.log(...) and the value your script returned with return.

    Warning: If your script performs updates, for example creating or editing work items, comments, or links, those changes are applied to your Jira instance even when running tests. Always test destructive or bulk-update logic in a non-production environment first.

Save a script from the script console

If you plan to reuse a script, save it so you can quickly run it again:

  1. On the Script console page, write your script.
  2. Select Save As.
  3. Enter a Name and, optionally, a Description.
  4. Optionally, add Labels to group this script with others.

    Start typing to reuse an existing label. Labels are saved in lowercase, with hyphens instead of spaces.

  5. Select Save to store your changes.

Your script is now available on the Saved console scripts page for future use.

Run a saved script

Use saved scripts to quickly re-run routine or previously tested tasks. To run a saved script:

  1. From ScriptRunner, select Saved console scripts.
  2. Find your script in the list and select Edit.
  3. Review the script and confirm it's still correct.
  4. Select Test script then Run to execute the saved script.

The output panel will show logs and the returned result. The execution will also be added to the script's activity history for future review.

Edit a saved script

You can update existing saved scripts to fix problems, enhance logic, or adapt them for new use cases. To edit a saved script:

  1. From ScriptRunner, select Saved console scripts.
  2. Find your script in the list and select Edit.
  3. Modify the configuration as needed.
    Changes are automatically saved.
  4. Optional: Select Test script, then Run, to execute the updated script and verify the results.

The activity history for the script is preserved, so you can track runs before and after your edits.

Delete a saved script

Remove saved scripts you no longer need to keep your list organized and reduce clutter. When you delete a saved console script, it's removed from your active scripts list, but it isn't permanently removed. You can still access and restore it from ScriptRunner if needed.

  1. From ScriptRunner, select Saved console scripts.
  2. Find the script you want to remove.
  3. Open the ellipsis (…) menu for that script.
  4. Select Delete.
  5. When prompted, confirm that you want to delete the script.
Note: Deleted scripts can be restored, including their activity history.

Restore a deleted script

You can restore deleted scripts along with their activity history. To restore a deleted script:

  1. From ScriptRunner, select Saved console scripts.
  2. Use the filter and select Deleted to view deleted scripts.
  3. Find the script you want to restore.
  4. Open the ellipsis (…) menu for that script.
  5. Select Restore.
    The script and its activity history will be available again in your active Saved console scripts list.

Search documentation

Start typing to search the docs.