Forums

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

What Insight riada import am I missing?

Eric Dierkens
Contributor
January 17, 2018

If I type this in to the ScriptRunner Console, it does not recognize iqlFacade.findObjectsByIQLAndSchema. I get a message the says it can't find the matching method. This happens with any objectFacade call such as objectFacade.loadObjectBean("object key here") ie TSD-18.

 

import com.atlassian.jira.component.ComponentAccessor;


 /* Get Insight IQL Facade from plugin accessor */
Class iqlFacadeClass = ComponentAccessor.getPluginAccessor().getClassLoader().findClass("com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade");
def iqlFacade = ComponentAccessor.getOSGiComponentInstanceOfType(iqlFacadeClass);

/* Specify the schema id as well as the IQL that will fetch objects. In this case all objects with Name matching the valueCF, be sure to include " around value */
def objects = iqlFacade.findObjectsByIQLAndSchema(1, "\"The attribute\" = \"" + attribute value + "\"");

// See the complete list of possible IQL on the Insight Query Language documentation page
/* If this is a mandatory field you should be able to do this: */
log.info("Insight object: " + objects[0]); return true;

 

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
PD Sheehan
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 Champions.
January 28, 2021

I think it's because there is no "page" object in that context.

When I create a panel in that same context

writer.write("""<div style="padding: 5px 5px 5px 0;">Test Panel: ${context.keySet()}</div>""")

I see just "Dashboard Test Panel: [action]"

So the only object inside the atl.page.metadata.banner is the "action" object

Byt outputing context.action.getClass() I was able to find my way to 

https://docs.atlassian.com/ConfluenceServer/javadoc/6.15.9/index.html?com/atlassian/confluence/pages/Page.html

Where I found that we can get the current page.

writer.write("""<div style="padding: 5px 5px 5px 0;">Test Panel: ${context.page.id}</div>""")

This returned the page id.

So I think if you just change 

def page = context.page as Page

to 

def page = context.action.page as Page

It might work

Martin Müller
January 28, 2021

Yes that's it. Awesome!

Thanks! :)

TAGS
AUG Leaders

Atlassian Community Events