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:
Save a script from the script console
If you plan to reuse a script, save it so you can quickly run it again:
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:
- From ScriptRunner, select Saved console scripts.
- Find your script in the list and select Edit.
- Review the script and confirm it's still correct.
- 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:
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.
- From ScriptRunner, select Saved console scripts.
- Find the script you want to remove.
- Open the ellipsis (…) menu for that script.
- Select Delete.
- When prompted, confirm that you want to delete the script.
Restore a deleted script
You can restore deleted scripts along with their activity history. To restore a deleted script: