Query Jira for Issues with Stash Pull Request

Is it possible to query Jira and find all issues that have a Stash pull request associated to them? I see the pull request show up in the "Development" panel when I navigate to a story with an associatied pull request, but I can't figure out if I can actually query for them or not.

I'd like to be able to run this to help track which stories were code reviewed using a pull request. Thank you!

7 answers

Found something. To sum up - you can query for:







With the proper combination you can get what you want - for example, merged pull requests :

issue.property[development].prs > 0 and issue.property[development].openprs = 0



Hope this helps. Still don't know how to query for succeded builds.


issue.property[development].prs > 0 and issue.property[development].openprs = 0

that does not represent merged pull requests unfortunately, as they can be declined, and this query will still return true. Still looking.

Have you found a solution for excluding Declined PRs?

Nope. Still nothing. Sorry.

Try this.... issue.property[development].commits > 0 AND issue.property[development].prs > 0


Not working for me - what's the issue.property syntax?

@Todd Ross Great! It works perfect. Just wondering, why query for 'issue.property[development].commits > 0'? When you have a pull request open, you always have commits associated to your JIRA issue?

@Todd Ross And while we're add it. Could you point me to a URL with info about issue.property syntax. I'm wondering if I can also query for open pull requests.

@Rudy Holtkamp [TMC] - Can you make it work with just 'issue.property[development].commits > 0'?

Hi @Ari Brown No, but it works with just issue.property[development].prs > 0. Unless I'm mistaking, you always have a commit associated when you have a pull request, so no need to check for commits.

Thanks Rudy - From what I know from standard JQL and what I can figure out that makes sense. Unfortunately I can't get anything to return when using that syntax and I'm wondering what, if anything, it requires. We've got stash, but is the issue.property[development].commits or prs more specific than that? Does it only work with certain types of repos? What other items might return info for me? Would love to understand the syntax better.

For your info Ari, we use JIRA 6.4 and Stash 3.10. What I understood from some info I found on developers.atlassian.com is that it has been added to JIRA 6.2. Are there types of repo's? (Accept for bare and normal?) Just wondering do you see a development panel in JIRA?

I've got Jira 6.3.9 and Stash 3.6.0. Should be fine on Jira, unless our stash version is too old... I don't think there are any other types of repos - I'm just surprised that I'm getting nothing here.

That format of JQL is only supported in JIRA 6.4 and above. It is not a publicised feature due to the fact it has a number of caveats that impact its usability. The information in JQL is only optimistically updated assuming you have JIRA and Stash connected via Applinks correctly (see https://confluence.atlassian.com/display/STASH/Linking+Stash+with+JIRA and https://confluence.atlassian.com/display/JIRA/Integrating+JIRA+with+Stash). In certain cases, changes in Stash will not be updated in JIRA unless you manually view the issue or view it as part of release hub https://confluence.atlassian.com/display/JIRA/Checking+the+progress+of+a+version. These cases are: * When JIRA is down or unreachable * When a repository is pushed to Stash with a lot of issues mentioned in the commits Hope this helps explain things

Thank you @Matthew Watson

Is there a method to find merged PRs in issues? Is there more documentation on precisely what is in `issue.property[development]` ?

No if you google you get referred to this link: https://developer.atlassian.com/jiradev/jira-architecture/building-jira-add-ons/jira-entity-properties-overview#JIRAEntityPropertiesOverview-Example2:Retrievingdata which does not help me. but ssue.property[development].failingbuilds is one that works, so if you do find others (succeeding build, branches?) please drop a comment Rudy

Seems like this has changed to be:

    development[pullrequests].open > 0

Other examples based off the error responses:

Available properties are "development[pullrequests]", "development[commits]", "development[reviews]" and "development[builds]" For "development[pullrequests]" use "development[pullrequests].all" or "development[pullrequests].open"


@Jay Sachdev, which version of JIRA is that?

Because it does not work on JIRA 7.3.1, do you have some add-on installed?

This post confirms this syntax. I've tested this out on JIRA cloud and it works.


Orphaned changes: development[pullrequests].all = 0 AND development[commits].all > 0

Unmerged changes: development[pullrequests].open > 0 AND development[commits].all > 0

Starting from Jira 7.8 the syntax of queries in Jira Server and Jira Cloud is the same. 

  • development[commits].all
  • development[pullrequests].all
  • development[pullrequests].open
  • development[reviews].all
  • development[reviews].open
  • development[builds].failing

More on that - https://confluence.atlassian.com/display/JSERVSHAREDM/.Advanced+searching+-+fields+reference+vJIRA_7.9

@Anton Genkin, your confluence link doesn't seem to be working.

Also, may you provide the exact syntax. I am unable to make it work and would appreciate an example.

Anton Genkin Atlassian Team Oct 11, 2018

@Alex Mears If you use Jira Software 7.8+ integrated with Bitbucket, then the following syntax will work:

  • Issues with PRs (any PR status): development[pullrequests].all > 0 
  • Issues with open PRs: development[pullrequests].open > 0 
  • Orphaned changes: development[pullrequests].all = 0 AND development[commits].all > 0
  • Unmerged changes: development[pullrequests].open > 0 AND development[commits].all > 0

When you do find out, I'm very interested in how. We can really use it for e.g. automatic transition of an issue (e.g. to review when a pull request starts).

Andrew Swan Atlassian Team Jul 16, 2015

Automated issue transitions are described here: https://confluence.atlassian.com/display/JIRA/Configuring+workflow+triggers

Were you able to figure this out?

No, I was not able figure out a means to do this. I was hoping someone from Atlassian would be able to verify that for sure.

I would also be very interested in knowing the properties that I can search for by issue.property[development].. as our main problem is to know which issues are ready for testing (have MERGED pull request).

Also I would like to know which issues will be included in the next build (example have issue.property[development].builds < 0 - unfortunately this does not work)

Generally I lack the functionality to query JIRA for properties that are stored in joined applications (stash, bamboo etc.)

You may find this useful: fixVersion = earliestUnreleasedVersion()

i found a relevant (i think) proposal for this - https://jira.atlassian.com/browse/BSERV-4048

it would be helpful if people interested in this voted for the issue

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,076 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you