You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have a CQL(Confluence Query Language) query:
код=P
and this query gives me two results:
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())
I've gone through quite a few discussions on this and have made two groovy scripts for two CQL query use cases. These can easily be modified as per requirements.
I know this post was from 2019, but I still think this is very useful. Hi from 2023 👋
1. Get values from the title column of a CQL query's results.
2. Add groups to Space permissions of the Spaces returned by a CQL query (this only works if the query contains type=space)
Do I understand correctly that these types of queries can not be executed in Cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the same, but getting error message:
groovy.lang.MissingMethodException: No signature of method: com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils.searchForContent() is applicable for argument types: (String) values: [space = AP]
at Script96.run(Script96.groovy:8)
Here is the script we tried on the scriptrunner console:
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cqlQuery = 'space = AP' // some CQL query
def pages = cqlSearchUtils.searchForContent(cqlQuery)
Any suggestions?
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearchUtils
import com.onresolve.scriptrunner.canned.confluence.utils.CQLSearch
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def cqlSearchUtils = ScriptRunnerImpl.scriptRunner.getBean(CQLSearchUtils)
def cqlQuery = 'space = KNOW' // some CQL query
def cqlSearch = new CQLSearch()
def pages = cqlSearchUtils.searchForPages(CQLSearch.fromQuery(cqlQuery))
pages.each{ page ->
log.warn page
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.