Hi guys, I'm pretty new to jira and scriptrunner.
I'm trying to load some sample code in the script console, but none of them are working :-(
What ever I try, I've got an error message when trying to load a class.
For example; with
import com.onresolve.jira.groovy.user.FormField
import com.onresolve.jira.groovy.user.FieldBehaviours
def OriginalEstimate=getFieldByName('Original Estimate')
I Have:
Script1.groovy: 1: unable to resolve class com.onresolve.jira.groovy.user.FormField @ line 1, column 1. import com.onresolve.jira.groovy.user.FormField
(same on line 2)
Am I doing something wrong ? Thanx for your help
Best regards...Larry
Hi Abraham,
Thank you for your question.
I can confirm that the reason that your code above will not work inside of ScriptRunner for Jira Cloud is due to the fact the code you have provided is fro ScriptRunner for Jira Server and this will not work as Atlassian only provide a rest API in Jira Cloud and do not provide a Java API in the cloud like they do in Jira Server.
You can see more detailed information on the differences between the cloud and server versions inside of our documentation page located here.
We would recommend reviewing the documentation for ScriptRunner for Jira Cloud which is located here along with the Jira Cloud Rest API Documentation in order to see how the REST API's work in Jira cloud.
I hope this information helps.
Kind Regards,
Kristian
Hi Kristian,
Yes very helpful. I wanted to perform some tests with script runner in a dev environment before updating a workflow in my office. My office environment is on a Jira Server. So now I guess that doing my test on a cloud environment might not be appropriated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abraham,
I can confirm the API's for Jira Cloud and Server are different as mentioned above which means you will not be able to test a feature for Server on Cloud.
Instead I would advise setting up a local version of Jira Server with ScriptRunner for Jira Server so you can test the server code you need before you put into your office environment.
I hope this helps.
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not all classes are available in all script runner editors
FormField and FieldBehaviours are part of the Behaviours implementation and wouldn't make sense in the Script Console.
I assume you've pasted a Behaviours example in the console.
What are you trying to perform?
Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Tom Thanks for your answer. Now it's clearer.
I just need to implement a condition validation on a workflow based on a field value. I saw in the recent version of Jira, that there is a "Field Value" builtin condition, but unfortunately, at work, we have an old version without this possibility. On the other hand, I have the option to set a script runner condition.
So I was just experimenting to find the good syntax to compare a field with a numeric`value. For experimented users, that is nothing, but when you don't know how...its not obvious
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.