Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner - JQL to search for confluence pages by property

Matt November 28, 2019

Hi Folks,

 

I've got a simple query ScriptRunner JQL query that returns all of the epics that have a link to a Confluence wiki page or are mentioned on a Confluence wiki page:

 

project = PROJECT and issuetype = epic and (issueFunction in linkedIssuesOfRemote("relationship", "mentioned in") or issueFunction in linkedIssuesOfRemote("Wiki Page"))

 

This query currently returns about 150 issues, including all of those which.  However an issue may be mentioned in a number of different pages that I don't care about, which means that my query is returning a number of false positives.

I can tag the pages in Confluence with a label or name prefix/suffix.  But I don't know how to query in ScriptRunner to only search for pages where this confluence label or prefix/suffix is set.

 

Can anyone help me with creating a query?  

1 answer

0 votes
Jeff Turner
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 28, 2019

The linkedIssuesOfRemote function is just querying the Jira 'remotelink' database table, which doesn't store much beyond the URL - certainly not label info. So that's a dead end.

Simplest would be to just filter out the known-incorrect Jira issues as part of your JQL ( 'and not key in (...)').

If you really need to filter on Confluence page labels, you'd have to write your own ScriptRunner JQL function that interacts with Confluence's REST API, and run a Confluence CQL search for 'macro = jira and label in ( ... )'.

Suggest an answer

Log in or Sign up to answer