Can i use Script runner for Groovy Script for Insight?

Julian from AF June 25, 2020

Hello,

i'm learnig Groovy Script. It seems to be easier to script with Script Runner than Console of Insight.

Is there a simply way? I create a simple script using tutorial of Mindville and copied it into Script Runner but it seems not recognize functions.:2020-06-25 10_50_35-Window.pngHave i to do specific thing to be able to use it? 

In Insight Console i can tell him the ticket for my test. Not here. Can you tell me how declare the ticket i want to get value?

 

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
Mathis Hellensberg
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.
June 25, 2020

Hi @Julian from AF

It should work either way, but if you want to be rid of the errors this approach should help. I never really cared much, but I'm sure someone brighter than me can give you a detailed explanation :)

import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.riadalabs.jira.plugins.insight")
import com.riadalabs.jira.plugins.insight.services.model.ObjectBean
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectTypeFacade

/* Get Insight Object Facade from plugin accessor */
def objectFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectFacade.class)

/* Get Insight Object Type Facade from plugin accessor */
def objectTypeFacade = ComponentAccessor.getOSGiComponentInstanceOfType(ObjectTypeFacade.class)
Julian from AF June 29, 2020

Hello it's working thank you @Mathis Hellensberg  :-)

Mathis Hellensberg
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.
June 29, 2020

@Julian from AF You're welcome! :)

Suggest an answer

Log in or Sign up to answer