Background Script

This module lets your app render a hidden panel in the new issue view or on a dashboard page to listen for events, poll for changes, or otherwise run code that consumes the JavaScript API. This allows your app to execute its functionality without adding unnecessary UI elements to the page.

The hidden panel behaves similarly to the web panel module in that it can reload on issue status transition and issue refresh depending on the value you assign to the shouldReloadOnRefresh property.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "modules": {
    "jiraBackgroundScripts": [
      {
        "url": "/issue-background-task-script",
        "location": {
          "type": "issue_view",
          "shouldReloadOnRefresh": true
        },
        "key": "my-issue-background-script"
      }
    ]
  }
}

Properties

key
Type
Max length
100
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

A key to identify this module.

This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

Keys must only contain alphanumeric characters and dashes.

The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

1
2
3
4
5
6
7
8
9
{
    "key": "my-addon",
    "modules": {
        "configurePage": {
            "key": "configure-me",
        }
    }
}

Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


location
Type
Required
Yes
Description

Specifies where the background script will be located inside Jira, and any location-specific configuration. Currently, a background script can only be located in the new issue view and on the dashboards.

Read about Issue Background Script Location. Read about Dashboard Background Script Location.


url
Type
Format
uri-template
Required
Yes
Description

The URL of the app resource that serves the iframe containing the background script. As with other app iframes, the iframe must load all.js. This URL does not support context parameters. This URL must be relative to the app's baseUrl.