Remote Issue Picker

A field that allows for picking an issue, or issues, from a pre-defined JQL query from a linked Jira instance. Examples for usage might be:

  • Connect an internal issue to its corresponding issue in a public-facing Jira instance

  • Link an internal issue to a blocking issue in an external Jira instance for an open source project

This is similar to a standard remote issue link, but has some advantages, and disadvantages, versus an issue link.

  • The primary problem with remote issue links is that you can’t control the subset of issues that can be linked to. This field allows you to do that by specifying a JQL query

  • Issue links are not fields, which means linking is always available. With a field you can enforce a link, or hide it at certain states of the workflow

Usage

Create a new field via Admin → Script Fields. Note that although you can create these types of field via Admin → Custom Fields, you cannot configure them there so it is easier to do it through the ScriptRunner interface.

You can preview the result…​ but note that if you are previewing before creating the field, you will not be able to see a preview of the view output as no issue will have a value for this field. Previewing is useful to verify that the picker is only displaying the correct candidate issues.

After creating the field ensure it has the correct context and the correct screens.

\

In this release you should ensure that the people who can edit issues with this type of field also have permission to view any linked remote issues. In a subsequent release we will improve this.

Searching

You can search for issues by prefixing the app link name. It’s probably easiest to do this using the basic search interface, then switching to advanced mode as necessary.

You can search for issues linking to a particular issue, example:

"Public Issue" = "Remote Instance:AAAA-10" "Public Issue" in ("Remote Instance:AAAA-10", "Remote Instance:AAAA-12")

You can also use the IN, !=, NOT IN operators.

Programmatic Updates

Creating an issue using IssueService:

        def issueService = ComponentAccessor.issueService
        def issueInputParameters = issueService.newIssueInputParameters()

        def relevantConfig = customField.getRelevantConfig(new IssueContextImpl(getTestProject(), getBugIssueType()))

        issueInputParameters.addCustomFieldValue(fieldId, "AAAA-10")
            .addCustomFieldValue("$fieldId:fieldConfigId", relevantConfig.id.toString())


You must provide the fieldConfigId number as shown above when using IssueService. This is because Jira doesn’t let us accurately retrieve the Field Configuration, which we need for retrieving the configured parameters of the field.

If you retrieve or set the value directly on the issue, the result will be a com.onresolve.scriptrunner.canned.jira.fields.editable.remoteissue.RemoteJiraIssueReference object, or if you have chosen a multiple issue picker, a Collection<RemoteJiraIssueReference>.

RemoteJiraIssueReference is a simple object with the following properties: id - the issue ID (not key) of the remote issue, and appId - the application link ID (not name).

        // single remote issue picker
        assert issue.getCustomFieldValue(customField) instanceof RemoteJiraIssueReference

        // multiple remote issue picker
        assert issue.getCustomFieldValue(customField) instanceof Collection
        assert issue.getCustomFieldValue(customField).every { it instanceof RemoteJiraIssueReference }

On this page