Web Panel

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.

Examples

Deprecated Space Notification

You can inform editors that a certain Confluence space will be deprecated, so they should update a page in another space.

  1. Choose the Show a Web Panel fragment.

  2. Fill out the form:


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

  3. Add the following code to theProvider Class/Scriptfield:

    writer.write("<div style='background-color: yellow; text-align: center'>" + "This space is going to be deprecrated. Please move" + " all content to the DOCS space</div>")

    This is the result of the above web panel, which should only appear in the specified space:

You must write to the provided writer object not just return a string.

Service Management Portal

You can display a web panel for a specific Jira Service Management portal in the servicedesk.portal.header location. . Create a web panel. . Enter this in the Condition section:

portal.id == 1

This code works in a portal window as the binding variable portal is available in Service Management portal context. But the code throws a groovy missing property exception in the user window because the variable is not available in a Service Management user window. To avoid this kind of scenario, check the availability of the variable, where applicable:

binding.variables.get("portal") && portal.id == 1

Test the script in different contexts to avoid unexpected errors. If necessary in the script, check availability of the variables to avoid exceptions.

Conditions

Conditions are largely the same as for web item conditions.

On this page