ScriptRunner for Jira Server Features
ScriptRunner in the Administration Menu
See Navigating to ScriptRunner for more information on how to access ScriptRunner features.
On the Behaviours page, you add and manage behaviours for your Jira instance. Behaviours modify fields, and you can apply them to projects and/or issue types.
On the Script Console page, you copy/paste or upload a script to run. The purpose of this particular area is for experimenting with the Jira REST API or for running the odd one-time script. The Script Console page includes a script editor box for you to copy/paste or write your script in.
You find a script editor like the one found on the Script Console page anywhere you choose to use a custom script option (so a custom script validator, a custom behaviour, etc.).
When using any of the script editors, after you write or copy/paste your code, look to the bottom right of the box. The script editors use a static type checking feature to check code. A green circle indicates your script is okay and it has found no errors in the code. A red circle with an "x" means that it has found one or more errors and displays the same icon on whatever line of code it has identified as having a problem. Hover over the icon(s) to see more info about the error.
It is important to know that this is just a basic check. Green means you haven’t made any errors that are relatively simple to catch, like not defining something or missing an import. You can still have a script fail even if it shows as green. Alternatively, you can also have a script pass and compile fine even though it appears to have an error, due to how static type checking works.
On the Built-in Scripts page, you can set up one of the built-in scripts available with ScriptRunner. These particular scripts are useful for global management, such as modifying field resolutions in bulk or viewing a list of all scheduled jobs set to run in your Jira instance.
On the Listeners page, you can add and manage your script listeners, as well as run built-in listeners in your Jira instance.
On the Script Fields page, you can add and manage script fields. With script fields, you can display a value from a ScriptRunner script in a new custom field that you create. For example, a scripted field that shows the number of times an issue has been in the selected status.
On the REST Endpoints page, you can see the REST endpoints available for the instance. REST is outside of the scope of this tutorial, but if you ever need to manage those endpoints, you go to this page in the ScriptRunner menu.
On the Script Fragments page, you can update web items and panels. This page includes both a custom web section, item, and provider; as well as built-in script fragments for user interface (UI) changes. Most of ScriptRunner deals with content and information, but script fragments allow you to use ScriptRunner for UI changes.
On the Escalation Services page, you can automate issue escalation processes. You can set up an Escalation Service to periodically modify issues based on JQL queries. This feature is outside of the scope of this tutorial.
Script JQL Functions
On the Script JQL Functions page, you can see all the additional JQL functions from ScriptRunner that you can use on your instance. You enable and disable script JQL functions from the UPM in the Modules section.
Again, you can only view the JQL functions on this page; you actually use them in regular JQL searches. These additional functions appear and act just like the standard Jira JQL functions, including being listed in the auto-complete suggestions as you write your JQL query. These functions are accessible by anyone who can search for issues in your instance, and this is the most common way that people use ScriptRunner without realizing it. Be aware that if you ever decide to uninstall ScriptRunner any searches or filters that used these additional JQL functions will break, which typically leads to unhappy users.
On the Resources page, manage and add database connections for use within custom scripts. With Resources you can set up connections to both internal and external databases, which are stored by ScriptRunner in a connection pool. This feature is outside of the scope of this tutorial.
And that’s it for our tour of ScriptRunner options from the Jira administration console.
Outside of the Administration Menu
Outside of the Administration menu, you can find ScriptRunner working in a few different places:
ScriptRunner conditions, validators, and post-functions are available through the Workflows section found in the Issues administration menu (for more information on how to navigate to them see our Workflow Functions documentation). Use these functions to further customise your workflows and set scripts to run before or after workflow transitions, or based on a certain condition.
The ScriptRunner Mail Handler expands on Jiras built-in feature and allows users to run groovy scripts when a message is receieved. The Mail Handler is available through the System administration menu, under Incoming Mail. This feature is outside of the scope of this tutorial.
|Continue the tutorial to learn about JQL Functions.|
Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.
Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.