Hi,
I'm trying to execute the following script in order to update insight object attribute
https://documentation.mindville.com/display/ICV60/Update+object+attribute
However, many syntax errors were displayed.
Any idea?
Thanks
Ahmed
The errors are all static checking errors, which can be ignored. You do need to define "issue" since the code assumes that this variable will be supplied by the caller.
If you are going to use ScriptRunner, there is a better way to bring in the Insight code:
import com.onresolve.scriptrunner.runner.customisers.WithPlugin@WithPlugin("com.riadalabs.jira.plugins.insight")
Put this code near the head of your routine. You can then import the Insight libraries like any other library. Here is some code sample that I wrote
import com.atlassian.jira.component.ComponentAccessor;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectSchemaFacade;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeAttributeFacade;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade;import com.riadalabs.jira.plugins.insight.services.model.ObjectBean;import com.riadalabs.jira.plugins.insight.services.model.CommentBean;import com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade;import com.riadalabs.jira.plugins.insight.services.model.factory.ObjectAttributeBeanFactory;//import insight.Insightimport com.onresolve.scriptrunner.runner.customisers.WithPlugin@WithPlugin("com.riadalabs.jira.plugins.insight");ObjectFacade of = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade);ObjectSchemaFacade osf = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectSchemaFacade);ObjectTypeFacade otf = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeFacade);ObjectTypeAttributeFacade otaf = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeAttributeFacade);
This approach has the advantage that you can eliminate the static type checking errors because you can tell groovy the type of object that you are instantiating.
Are you executing this in the Insight Script Console? Can you provide the syntax errors that you see?
RIght @Derek Fields _RightStar_
my guess the errors pop up in the ScriptRunner editor.
Best
JP
You have just to copy paste the script in scriptrunner's script console. Errors are related to insight classes
Regards,
There are differences between Insight's script console and ScriptRunner's console. They don't use the same groovy class and they set up the script environment slightly differently. In fact, there appears to be (or have been) a difference between the script console and the automation script runner. This has bitten me in the past.
You may be right and the code will work in ScriptRunner, but I would expect Mindville's code to have been written and tested in their environment.
It's working fine
Many thanks
It looks like you're new here. Sign in or register to get started.