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:

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

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.

create remote issue picker

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.

remote issue picker usage
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 }

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.