Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,818
Community Members
 
Community Events
168
Community Groups

What Insight riada import am I missing?

Edited

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

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

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")

 

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

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

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

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

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

Cheers,

Florent

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events