How to list the globalId to use in issuesWithRemoteLinksByGlobalId("") JQL function?

Béla Fricz December 3, 2015

Hi,

I was not able to find the in the documentation for "globalId" definition and how to get it on the server.

Could you please help to find the documentation for it?
I would like to try out the built-in JQL function "issuesWithRemoteLinksByGlobalId()" to list issues linked with pages towards our Confluence server.

The only documentation what is touching the topic:
https://developer.atlassian.com/jiradev/jira-platform/guides/other/guide-jira-remote-issue-links/fields-in-remote-issue-links

Kind regards,

Béla

6 answers

9 votes
Jeremy Modjeska October 24, 2017

Late to the party here, but I had to learn this trick today and thought I'd share my results, since it isn't well-documented.

These steps will seem a bit backwards, but bear with me. For this example I'm assuming you're using cloud Jira and Confluence, so your applications are hosted at https://example.atlassian.net/. 

  1. Assuming you know that a particular Confluence page contains a link to a Jira ticket called EXAMPLE-1234, you can query the Confluence REST API for all mentions of that Jira ticket with: https://example.atlassian.net/rest/api/latest/issue/EXAMPLE-1234/remotelink. This API request says, "show me all the external integrations that link to EXAMPLE-1234".
  2. The above API request will return a JSON blob listing every external integration where the ticket EXAMPLE-1234 is linked. For example:
    {
    "id": 55555,
    "self": "https://example.atlassian.net/rest/api/latest/issue/EXAMPLE-1234/remotelink/55555",
    "globalId": "appId=abc-123-cde-456&pageId=987654",
    "application": {
    "type": "com.atlassian.confluence",
    "name": "Confluence"
    },
    "relationship": "mentioned in",
    "object": {
    "url": "https://example.atlassian.net/wiki/pages/viewpage.action?pageId=987654",
    "title": "Page",
    "icon": {

    . . .

    }
  3. The critical information you're looking for there is line 4, which contains your Confluence globalId, a combination of your Confluence integration's appId and the specific Confluence pageId where the ticket is mentioned.
  4. Copy the globalId, and you can form the JQL query you're after, which is "show me all the Jira issues linked on Confluence page ID 987654":
    issue in issuesWithRemoteLinksByGlobalId("abc-123-cde-456&pageId=987654") 

Finding the appId is the hard part of this, and the reason we've done this whole silly API request. Once you've identified your appId using the steps above, you can construct queries using any Confluence pageId by replacing the pageId bit of the query (987654) with the ID of any page on Confluence. The pageId is, of course, the number after /pages/ in the Confluence page's URL. Now you're equipped to use issuesWithRemoteLinksByGlobalId() against any page in your Confluence instance.

Hope that helps!

Béla Fricz October 25, 2017

Thank you! This is really useful.

In the meantime we started to use a plugin for this kind of query:

https://marketplace.atlassian.com/plugins/ca.nuum.impact/server/overview

 

But still this JQL trick can be really useful for scripts!

Have a great day!

Béla

Mathew Newton November 16, 2020

We need to extract the JIRA ticket mentions on a group of pages. Each page are the notes from a weekly meeting. We have them all grouped under a parent meeting page. At the moment our filters have to have each new page added on a weekly basis. There is a limit to how many of these additions can be made and we would prefer to not have to edit them filters. Does anyone know how to user the ancestor field or other to access the child page jira ticket mentions?

Amr ROQDI January 24, 2023

Hello Mathew,
I'm facing the exact same difficutly. Did you find a solution on your side by any chance ??

4 votes
Jeremy Modjeska September 24, 2018

Quick update: I had to reference this again for a recent project and found that the syntax has changed. JQL now includes `appId=`, as follows:

issue in issuesWithRemoteLinksByGlobalId("appId=abc-def-123-2349832942&pageId=12345678")

Hope that helps. 

Penelope Hobbs April 16, 2020

You can find the appId in this format without using the API directly if you:

  1. Inspect a page which includes details for an issue mentioned on a confluence page (I used the backlog with a relevant issue selected)
  2. Look for a network request whose response body includes something like "bentoViewIssue_remote_data" (the "remote_data" is the important part)
  3. Tunnel down into the response body and you'll find the globalId for any linked or mentioned pages

The details are likely to change over time but the basic method should remain viable.

0 votes
Danno
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 8, 2021

Well, at least I now know that a remote link means it is a link to another app tied to Jira. I was trying to use this strictly within Jira in a filter to get linked issues. So much for the Atlassian documentation being useful.🤨

0 votes
Ryan Beymer February 27, 2019

@Jeremy Modjeska Thanks for that, there is a definite gap there in the two products and your JQL wizardry made it less painful.  

0 votes
Vinod Honnalli August 20, 2016

Hi Scott,

Hey i have no answer to give, i am here to ask some questions.

My Scenario is  :

In our JIRA, there are some issues which are linked to remote applications which i do not have access, when i filter all those issues and export to excel, there are no links shown related to the remote applications in the exported excel.

Can you please help me to get an solution for it.

Suggest me if this can be achieved by REST API.

Thanks in advance.

0 votes
Scott Lindner April 19, 2016

This is an old question but I recently encountered it and will offer what I have found. I used the REST API to get an example of a global ID. It doesn't appear to be something you can find from the UI. Not entirely anyway. What I found on our systems is that the global ID is in the following format "appId=<Confluence AppID GUID>&pageId=<Confluence Page ID>". I tried a couple of different JIRA issues mentioned in various pages and it seems the appID is always the same for the same Confluence instance and the pageId is what you find in the URL on Confluence. When I query in JQL using this Global Id it appears to only match JIRA Issues that are mentioned in Confluence using the JIRA Macro in Confluence. Simply stating the JIRA ID in Confluence is not enough or it to be "Mentioned In".

 

I hope this helps.

Suggest an answer

Log in or Sign up to answer