Scripted Fields
Before you start
Visit ScriptRunner HQ to see example scripts.
Watch our Scripted Fields demo video.
Groovy Scripts
Remember, our scripts are written in Groovy! Check out our page on Scripting in ScriptRunner for Jira Cloud for tips.
What are Scripted Fields?
You can use ScriptRunner for Jira Cloud's Scripted Fields to customise how the information for an issue is displayed. They enable you to display information that would otherwise be unavailable for an issue by calculating or amalgamating data from one or more existing fields. Check out our examples for more details.
Scripted Fields appear on your screens when you assign their associated custom fields to the relevant screen.
Add-on User
All scripted fields are executed as the add-on user. The add-on user is the user who is created for the add-on app and has permissions granted for that add-on. The add-on user is automatically generated upon ScriptRunner installation and added to the Atlassian-addon-group permission group. You can refer to Atlassian's documentation on permissions for Cloud.
Scripts written for Scripted Fields are always executed as the add-on user and, as such, will have the correct set of permissions granted. However, if the permission schemes are changed for the Atlassian-addon-group, then there is a possibility that Scripted Fields will not work as intended.
How to use Scripted Fields
Scripted Fields that trigger Script Listeners, and vice versa
Scripted Fields issues are updated after a script is executed, triggering an issue_updated webhook event in Jira. This event is sent to ScriptRunner but does not cause the script to run again or trigger any associated script listeners configured for issue update events.
Script Listeners that update issues will trigger an issue_updated webhook event in Jira which is then sent to ScriptRunner. If scripted fields are configured for the updated issues, they execute once, updating the issue and triggering another issue_updated webhook event without the need for any further processing.
Scripted Fields are a type of calculated field, allowing you to display a calculated custom field using ScriptRunner scripts that run when an issue is viewed. It's good practice to keep these scripts as simple as possible to reduce loading time. The Scripted Fields feature allows you to update issues in bulk.
Currently, scripted field results are only updated when viewing an issue and also when an issue that contains a scripted field is updated. This means that they must be reloaded or modified as they do not update dynamically. Please keep this in mind when using scripted fields in JQL filters.
Scripted Fields work by using the same process as other scripts, such as Script Listeners, where you write code that executes REST API calls to either the Jira Cloud Rest API or your own external REST API call.
