Web panels can be used to add HTML snippets to parts of a page. They could be used to display additional information on a particular build, a plan, or the system navigation. For more information, read up on web panels in the Atlassian documentation.

As a simple example, let’s imagine we want to add a warning banner to a plan that is deprecated.

From the Script Fragments page, choose the Show a web panel built-in script, and configure it as follows:

web panel

The main thing to copy is the location, which should be plan.result.header.breadcrumbs.

The weight field is optional, and it only takes positive integers. Lower weights will make the panel be displayed at the top of its section. If blank it will appear at the end of its section.

Provider class/script (either directly as an inline script, or from a file):

writer.write("""<div style='background-color: yellow; text-align: center'>
    This build plan is deprecrated, and will be removed soon. Please switch to using
    the WIDGET build plan in this same project.
You must write to the provided Writer object, not just return a String.

Once configured, you should see a box of yellow text at the top of a build page.

web panel banner

Using the Context

So, that’s handy, but what if you want to restrict that banner to only certain plans? After all, you probably didn’t deprecate every build in your instance. Let’s say that we know which plans are deprecated based on their plan key containing the word "LEGACY". Add the following condition to the panel’s configuration. You can ignore the red static compilation error in the code editor.


The context object has information about the currently displayed page, and will vary somewhat from page to page. You can experiment with what’s available in the context by logging it and viewing your server’s log files.

log.warn "Context: $context"

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.