Script Fragments

ScriptRunner is primarily concerned with the back-end, but also has the capability to customise the web UI through dynamically adding web fragments - see the Atlassian documentation on web fragments for

Simple examples of customising the UI are:

  • show an announcement banner

  • show different banners for admins, non-admins, and users who are not logged in

  • add buttons to the Tools menu for particular pages

This is accomplised by adding a UI customisation at Admin → Script Fragments.

There are several different types of fragment built-in scripts available:

  • Web Item - a link or button that will appear in your chosen location

  • Web Panel - display additional information in a panel

  • Web Section - define new locations in which to add items

  • Web Resource - define custom JavaScript and CSS resources in specific contexts

As always, you should test in a development environment before deploying to your production environment.

Usage

The general usage of these scripts is to go to Admin → Script Fragments, and execute one or more of the built-in scripts. This will modify the UI in the chosen way. Following this, you can edit or delete the customisation.

After restarting your instance the UI customisations will be in place.

At the moment, some scripts will be reloaded automatically, but if not, you can edit the built-in script item, and click update.

All of the built-in scripts produce XML that is similar, but not interchangeable with, the XML found in a plugin descriptor. You will notice that, for usability reasons, the forms do not provide all the possible configuration elements available in plugins. As an example, the web-item built-in script does not give you the option to provide a tooltip for the web-item link, or a velocity context provider, or an icon URL.

You can work around this limitation using the raw xml module script.

Fragment Locator

You may not know where the locations or sections for web items, web sections, or panels. The Fragment Locator tool is designed to show you the places where you can put these fragments.

Enable it from Admin → Script Fragments.

Enabling the fragment locator will change the appearance of every page for every single user, so should not be enabled in a production system. If this is not a production system then proceed to click the Enable button.

New version

On this page