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
;
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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for your answer Eric. Sad that you did not stick with Scriptrunner.
Cheers,
Florent
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.