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

What Insight riada import am I missing?

Eric Dierkens 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

Suggest an answer

Log in or Sign up to answer
0 votes
Daniel Yelamos [Adaptavist]
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.
January 18, 2018

If i'm not mistaken, you are missing the @withPlugin tag.

Check our documentation about it here: 

https://scriptrunner.adaptavist.com/4.3.5/jira/scripting-other-plugins.html

Did this help? If so, could you accept my answer so that other users know that this question has been solved?

Cheers!

DYelamos

Eric Dierkens January 18, 2018

I just tried and I get this error

"Unable to resolve class WithPlugin, unable to find class with annotation"

We have Riada Insight installed and it is working great.

The good news is that I have switched to using the Insight Script Console and it works for this.

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.mail.Email;
import com.atlassian.mail.queue.SingleMailQueueItem;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.event.type.EventDispatchOption;
import org.joda.time.DateTime;
import java.util.Locale;
@WithPlugin("com.riadalabs.jira.plugins.insight")

 

Daniel Yelamos [Adaptavist]
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.
January 19, 2018

You are missing the import for the annotation sir:

Add this import:

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

And check again, I'm confident this will work!

Cheers!

Dyelamos

Eric Dierkens January 30, 2018

This import works within ScriptRunner

import com.onresolve.scriptrunner.runner.customisers.WithPlugin

 

but this one does not

import com.riadalabs.jira.plugins.insight.services.model.ObjectBean

Florent Michelis January 9, 2019

Hi Eric,

I'm digging this thread because we're having the same problem with importing

com.riadalabs.jira.plugins.insight.services.model.ObjectBean class.

Did you find a solution in the end?

Cheers

Florent

Eric Dierkens January 9, 2019

We had so many wierd errors and it was so hit-and-miss and because there is no common interactive IDE design environment, like Visual Studio, for writing and debugging code we switched all of our code over to C# and now use the REST APIs.

 

One of the issues was that each thrid party vendor has their own script editor and we are not confortable replying on third party add-ons from so many sources.

Like Florent Michelis likes this
Florent Michelis January 9, 2019

Thank you very much for your answer Eric. Sad that you did not stick with Scriptrunner.

Cheers,

Florent

Eric Dierkens January 9, 2019

ScriptRunner is a good product in itself, but to me if writing code is such an intergral part of an application/software suite, then maybe it should be part of the core software to supply a built in editor OR integrate with something like Visual Studio that can be used regardless of language choice. Not being able to debug or step through code is a non-starter for me.

TAGS
AUG Leaders

Atlassian Community Events