Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to execute CQL query in Confluence ScriptRunner? Edited

I have a CQL(Confluence Query Language) query:

код=P

and this query gives me two results:

CQL - confluence query language.png 

How is it possible to execute this code in Confluence ScriptRunner? I mean execute cql query  in Confluence Script Runner like it can be done in Jira ScriptRunner.

 

I've tried to use Jira ScriptRunner code, but Jira code is not working in Confluence Script Runner:

String JqlQuery = "issueType = Epic AND project = HH AND 'Epic Name' = 'epic name'"
def parseResult = searchService.parseQuery(curUser, JqlQuery)
def searchResult = searchService.search(curUser, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())

 

1 answer

You can use the `CQLSearchUtils` class for this.

import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cql = "space = FOOBAR"
def results = cqlSearchUtils.searchForContent(cql)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Comparison between Zephyr & Xray

I am sharing this article with both Zephyr and Xray information and everything should be in one place. It will be easy to know when selecting Zephyr or Xray. Zephyr and Xray are both Jira plug-ins u...

180 views 1 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you