I'm attempting to use the "Total time this issue has been In Progress" script to add a field to the tickets in a specific Jira Project. After I fill out the necessary fields in the Add New Scripted Fields form, I copy the script and click the Test button. This is the error I get. Any ideas on how I can resolve this?
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)
Thanks for your help!
That looks like a scriptrunner for jira Server/Data Center script ... but you tagged your question as cloud.
You can't import jira server api classes into scriptrunner cloud script.
I'm not sure what the equivalent script for cloud would be.
Hi @Dawn Rodney
It seems that you are using code for the server. This is the reason why you are getting the error. You cannot use a script from the server in a cloud environment. This will not work in a cloud environment. Also, I would also like to share the documentation on the differences between server and cloud environment here.
The Scripted Fields as documented inside of the documentation page located here which provides details of how to create new script fields and some examples of what Script Fields can be used for.
Script Fields work using the same process as other scripts such as Script Listeners where you write code that executes rest API calls to either the Jira Cloud Rest API or to your own external rest API call in order to perform an action and to return a value according to the return type you specify as mentioned in the documentation page located here.
Finally, I can confirm that Script Fields will appear on either the Issue Content panel or Issue Sidebar depending on what you choose when you configure your script field.
Hope this will help you.
If you already heard about Smart Commits in Bitbucket, know that you just stumbled upon something even better (and smarter!): Genius Commits by Better DevOps Automation for Jira Data Center (+ Server...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events