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

Exetcuting iql with groovy script

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

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. :-)

Thank you very much))

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

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. :-)

Thank a lot :)

It worked with objectTypeId.

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 Badr Nazzal likes this
0 votes

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

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

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!

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

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" + "\"");

Suggest an answer

Log in or Sign up to answer
TAGS

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