Forums

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

Exetcuting iql with groovy script

Jamil Rahimov
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.
June 6, 2018

Hi, I am new in jira.

I want ask one question.How can I retrieve object with this iql:"Created" > now(-5d) and "Created" < now(-4d) on groovy script?

I need Name of the objects which described in the image.

1.PNG

 

3 answers

1 accepted

2 votes
Answer accepted
PJ Wysota
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.
June 6, 2018

Riada has got pretty nice documentation on Insight so I would start to look at https://documentation.riada.se/insight/latest/insight-advanced-usage-guide/insight-for-developers/groovy-scripting/groovy-script-examples

Then - (consultant's answer) it depends on use case. :-)

Jamil Rahimov
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.
June 6, 2018

Thank you very much))

Jamil Rahimov
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.
June 6, 2018

Can you help me,please?

Why does it show errors?2.PNG

My object schema id is 3 and I used IQL in iql.facade.findObjectsByIQLAndSchema() but it gives error

3.PNG

Like # people like this
PJ Wysota
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.
June 7, 2018

I would try Object TypeID parameter instead of name - don't know for what reason but with some IQL functions these work better. If still nothing - post a ticket to Riada Support - 

I love those Swedes for prompt replies and fast turnaround with requests (recently my team logged 8 within a month - all resolved within 72h) - https://riada.se/service-center/product-support/

BTW - You might follow Valiantys blog: https://blog.valiantys.com/en/ - soon there will be few posts from myself on mastering Insight. :-)

Jamil Rahimov
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.
June 7, 2018

Thank a lot :)

It worked with objectTypeId.

sao bien November 15, 2019

Hi 

I aslo get the same error as you now. Could you show me how to fix error "can not find matching method with " def objects = iqlFacade.findObjectsByIQLAndSchema(81, "objectypeID = 243") 

Thank so much

Like # people like this
0 votes
Julian from AF
Contributor
June 26, 2020

Hello,

not so easy but i found the correct syntax : 

For : objectType = "Applications Workstation"

use : 

def objects = iqlFacade.findObjectsByIQLAndSchema(10,"\"objectType\" = \"" + "Applications Workstation" + "\""); // See the complete list of possible IQL on the Insight Query Language documentation page

Julian from AF
Contributor
June 26, 2020

I'm trying to found the good syntax for my complete IQL but not easy to construct it : 

 

objectType = "Applications Workstation" or objectType = "Applications Servers"

not working : def objects = iqlFacade.findObjectsByIQLAndSchema(10,"\"objectType\" = \"" + "Applications Workstation" + "\"" + "\"OR\" + "\"objectType\" = \"" + "Applications Servers" + "\"");

0 votes
Tarun Sapra
Community Champion
June 6, 2018

Hello @Jamil Rahimov

It's pretty easy to execute JQL via groovy/ script runner. You have to use SearchService and QueryParser

Please see here 

https://community.atlassian.com/t5/Marketplace-Apps-questions/How-to-run-JQL-query-inside-Groovy-script/qaq-p/194691

PJ Wysota
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.
June 6, 2018

It is rather for IQL (Insight Query Language) from Insight for JIRA. AT least as I look at the screen. :-)

Tarun Sapra
Community Champion
June 6, 2018

Hello @PJ Wysota

Indeed, not used to queries around IQL in the community, just comes across too much similar to JQL :)

 I have upvoted your answer!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events