Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Migrate Jira Server Scriptrunner's scripts to Cloud (From Script Editor)

Nicolas PR
Contributor
June 8, 2023

I'm in the process of migrating my Jira instance from Server to Cloud, and I'm using Scriptrunner with several custom scripts.

Currently, on my Jira Server, I manage and package all my code in the Script Editor panel of Scriptrunner. This is beneficial because I can separate my code logic and reuse class definitions across various scripts, behaviors, and validators using the package definition.

However, I was surprised to find that the Script Editor panel is not available in the Cloud version of the app (unless I missed something but it is in the doc: https://docs.adaptavist.com/sr4jc/current/differences-between-scriptrunner-for-jira-server-and-jira-cloud/feature-parity). This is soooooo surprising and I couldn't understand why ... it was so usefull ...

Could you please advise on how to import and manage my packaged classes in the Jira Cloud instance?

2 answers

1 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
June 8, 2023

Hi @Nicolas PR

It's not possible to import your code directly from the Server / DC instance to Cloud.

In the Server instance, you can directly access the code and API. However, in the Cloud this is not possible.

You will need to make REST requests to get the details of the fields that you want to update and set the value accordingly.  

I suggest reading through the Server to Cloud migration documentation as well as Tips for Re-Writing your scripts for migration for more information.

Thank you and Kind regards,

Ram

Nicolas PR
Contributor
June 9, 2023

Hi @Ram Kumar Aravindakshan _Adaptavist_  Thank you for your response.
That's what I had read, but I was concerned that a part of my logic, which is based on the use of Jira's Java API and my package definition for reusability (using stored scripts and Script Editor), would become largely obsolete.

To summarize:

1. The Java API cannot be used anymore, and scripts should be designed to use the REST API instead (for more information: https://scriptrunner-docs.connect.adaptavist.com/jira/).
2. The capability to define scripts in files no longer exists, only inline scripts are available, which are not reusable by definition
3. It is not possible to save and manage custom scripts snippets from ScriptConsole or Browse page)
4. Custom REST Endpoints no longer exist, so reusable scripts cannot be defined and used as RestEndpoint neither.

(Other: 5. I was using Behaviours with javascript injection in description fields in  JSD/JSM's forms, this is no longer possible ?)

Did I understand correctly?

Thank you

Nic Brough -Adaptavist-
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 10, 2023

DC/Server and Cloud are totally different applications, and hence Scriptrunner is too.

  1. You are right about the REST API - Scriptrunner for Cloud can only do things that the Cloud REST API allows it to do.  SR has no access to the java API behind Jira Cloud.  You do not need to script for using the REST API directly - SR handles that for you, but you do need to rewrite your scripts to use what SR can do with Cloud.
  2. Yes, because SR can't  has no access to the Cloud file system, and we didn't code it to store scripts on the SR servers because we couldn't allow access to them either.
  3. No, because that uses the file system
  4. REST endpoints are not currently made available in Cloud Jira, but it is something we will add if Atlassian ever enables us to.
  5. Cloud does not allow any injection of javascript, but you can use Behaviours to modify some screen functions now (It took a long time to get Atlassian to enable us to code for Behaviours for Cloud, and it still has limited functionality.  It'll never allow javascript injection though)
0 votes
Nicolas PR
Contributor
June 12, 2023

Okay, thank you to both of you for your valuable responses,
It seems like the journey ahead will be long and tedious...

Kind Regards

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events