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

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

91 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you