Hello,
I'm using the Jira Cloud version + ScriptRunner For Jira (add-on).
I want to create a custom field for each of my jira issue where I want to calculate the time spent in the status "In Progress" for each issue and display it in a custom field (in each issue).
I found the following script on the Adaptavist library:
https://library.adaptavist.com/entity/count-the-time-an-issue-was-in-a-particular-status
But When I try the script I get the following errors (NOTE: I'm not a software developer):
Seems to me he cannot import the following libraries:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
(seems like they don't work in Jira cloud... just guessing here)
Anyone know how to make that sample script work in the Jira Cloud Version? Thanks
An error occurred whilst running the scripted field.
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy:
1: unable to resolve class com.atlassian.jira.component.ComponentAccessor @ line 1, column 1. import com.atlassian.jira.component.ComponentAccessor ^
Script1.groovy:
2: unable to resolve class com.atlassian.jira.issue.history.ChangeItemBean @ line 2, column 1. import com.atlassian.jira.issue.history.ChangeItemBean ^
2 errors at
com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:48) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:31) at com.adaptavist.sr.cloud.events.ScriptedFieldExecution.run(ScriptedFieldExecution.groovy:30) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at TestScriptedFieldExecution1_groovyProxy.run(Unknown Source)
FYI, that code is for Jira Server, but not Jira Cloud. I doubt this is your issue, as I'm seeing something similar with a simpler piece of code:
return "Hello world!"
For a text field.
I'm about to raise a support ticket for this and will post the response, as it will hopefully help someone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.