Issue Field

This module allows the app to add a new issue field to Jira.

The key of the field, that can be used to reference the field in the REST API, is: $(app-key)__$(module-key).

Available options for fields of the single_select or multi-select type are managed with the REST API for issue field options.

ISSUE_CHANGED event

Apps can receive a frontend event notifying them that an issue changed, either by being updated or commented on. This event is only available for Jira issue view modules.

1
2
3
AP.events.on('ISSUE_CHANGED', function (data) {
  console.log('ISSUE_CHANGED (Connect)', data);
});

However, if you have multiple issue view modules in your app, you should use the Jira issue view background script module. This will give you a central place for fetching issue details, thus reducing the number of network requests and improving the user experience. Fetching issue details separately for every module would introduce unnecessary overhead and degrade performance.

Data shape

1
2
3
4
5
6
7
8
{
  "issueId": string,
  "projectId": string,
  "changes": [{
    "changeType": "updated" | "commented",
    "atlassianId": string
  }]
}

  • issueId - ID of the issue the app is rendered on
  • projectId - ID of the project the issue belongs to
  • changes - the list of issue changes
  • changeType - type of the change
  • commented - a new comment was added to the page
  • updated - the issue has been updated
  • atlassianId - ID of the user who made the change

Limitations

  • UI kit apps don't have an event system in place and so aren't supported.
  • There is a delay between the moment the issue is modified and when the event is emitted. It might take up to a few seconds.
  • We can't guarantee that all issue change events will be received by Jira. Therefore, the issue view may sometimes remain stale.
  • When the issue is modified by the user who is currently viewing it, it will not be refreshed. This is because we assume the change was made by that same user and there is no need for an update.

Example

For a full add-on example, see issue field example app.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "modules": {
    "jiraIssueFields": [
      {
        "description": {
          "value": "field with team"
        },
        "type": "single_select",
        "extractions": [
          {
            "path": "category",
            "type": "text",
            "name": "categoryName"
          }
        ],
        "name": {
          "value": "Team"
        },
        "key": "team-field"
      }
    ]
  }
}

Properties

description
Type
Required
Yes
Description

Description of the issue field. This will be displayed for the user under the field in the create or edit issue view.

Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

Example

1
2
3
4
{
  "value": "My text"
}

Properties

value
Type
Max length
1500
Required
Yes
Description

The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

i18n
Type
Max length
300
Description

The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


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.


name
Type
Required
Yes
Description

A human readable name.

Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

Example

1
2
3
4
{
  "value": "My text"
}

Properties

value
Type
Max length
1500
Required
Yes
Description

The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

i18n
Type
Max length
300
Description

The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


type
Type
Required
Yes
Allowed values
  • string
  • STRING
  • text
  • TEXT
  • rich_text
  • RICH_TEXT
  • single_select
  • SINGLE_SELECT
  • multi_select
  • MULTI_SELECT
  • number
  • NUMBER
  • read_only
  • READ_ONLY
Description

The type of the field. The following types are available:

  • number Allows to set a number.
  • string Allows to set a string, supports exact matches in JQL.
  • text Allows to set a string, supports fuzzy search in JQL (with the "~" operator).
  • rich_text Allows to set multi-line text in Jira, and supports fuzzy search in JQL. Note: If you migrate from text to rich_text for an already existing field, the data won't be migrated.
  • single_select Allows to select one value from a predefined set. The Issue field options REST API can be user to manage available values.
  • multi_select Allows to select multiple values from a predefined set. The Issue field options REST API can be used to manage available values.
  • read_only Displays a given issue property, not editable by users.

extractions
Type
Description

Extractions used for JQL search. This is valid only when the type is single_select or multi_select.


property
Type
Description

The property that stores the field value.

Required when the type is read_only, otherwise not used.

Defines an issue property that will store the value for the issue field of the read_only type.

Example

1
2
3
4
5
6
{
  "path": "comments.count",
  "key": "statistics",
  "type": "number"
}

Properties

key
Type
Required
Yes
Description

The key of the issue property.

path
Type
Required
Yes
Description

The path to the value in the JSON object.

For instance, for JSON "{"label": {"color": "red", "text":"connect"}} the valid path referencing the color is label.color.

type
Type
Required
Yes
Allowed values
  • number
  • NUMBER
  • string
  • STRING
  • date
  • DATE
Description

The type of the referenced value. It will affect how the value is interpreted and displayed, and how the field behaves in JQL.

The type can be one of the following:


template
Type
Description


Jira Issue field link templates are deprecated and no longer functional on the new Jira issue view.


The template used to render options. This is only valid when the type is single_select or multi_select.


Jira Issue field link templates are deprecated and no longer functional on the new Jira issue view.


Defines the template used to render issue field options in the UI view.

Properties

type
Type
Required
Yes
Allowed values
  • link
  • LINK
Description

Type of the template.

url
Type
Required
Yes
Description

If the type is 'link' then this specifies the URL template for the link. It is possible to use context parameters in the template.

The URL may be relative or absolute. If it is the former, then the Jira context path will be prepended automatically.

The following context parameters are available:

  • option.id, option.key, option.properties
  • issue.id, issue.key
  • project.id, project.key
  • user.id (deprecated), user.name (deprecated), user.accountId


Rate this page: