ShareShare on LinkedIn.Share on Facebook.Share on Twitter.Share via email.

The ScriptRunner Rundown

May 4, 2021
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>Using <a href="https://www.adaptavist.com/products/atlassian-apps/scriptrunner-for-jira" target="_blank" rel="noreferrer noopener">Adaptavist ScriptRunner for Jira Server</a> is much like souping-up a car. Sometimes, it can even seem as magical as Dr. Brown’s DeLorean from Back to the Future. With the announcement from Atlassian to move away from server and focus solely on cloud, we have to wonder if ScriptRunner for Jira Cloud is going to match up to its predecessor.</p> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="570" height="329" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/YTM5YmY0NGMtYmUyMS00ZmM5LWFmOWEtZTAwZjFiYzk0ODkz_supercharge-your-customer-support-portal-with-scriptrunner.png" alt="" class="wp-image-78" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/YTM5YmY0NGMtYmUyMS00ZmM5LWFmOWEtZTAwZjFiYzk0ODkz_supercharge-your-customer-support-portal-with-scriptrunner.png 570w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/YTM5YmY0NGMtYmUyMS00ZmM5LWFmOWEtZTAwZjFiYzk0ODkz_supercharge-your-customer-support-portal-with-scriptrunner-300x173.png 300w" sizes="(max-width: 570px) 100vw, 570px"></figure> </div> </div> <p>There are significant differences between how add-ons can integrate with Atlassian Cloud versus Server. The server versions of Atlassian’s products allow apps (i.e. add-ons) to run on the same machines, create databases specific to the app instance, and interact with the lowest level API. With Atlassian Cloud, add-on developers are limited to running code within the users’ browser (via Javascript) or on their own servers; the only integration points are through the Atlassian Cloud REST APIs.</p> <p>While some ScriptRunner for Jira Server functionality can be re-written to interact with the Cloud REST API rather than the low-level Java API, porting to Cloud is more than simply translating from one API to another. The shift from Server to Cloud is also a change in the fundamental architecture, where the key characteristics of state and synchronicity shift. In the server environment, API requests were synchronous (i.e. requests wait for a response) and state was maintained. In the cloud environment, REST APIs, are asynchronous and stateless. Put another way: the results of script execution may not be visible or evident within the UI immediately.</p> <p>As a result of the shift to cloud, an app is no longer able to fully integrate with all aspects of the Atlassian product. This change in architecture has forced ScriptRunner to drastically alter what they provide for Atlassian Cloud products.</p> <p>The remainder of this article summarizes the limitations of ScriptRunner for Jira Cloud.</p> <h2 class="wp-block-heading">ScriptRunner for Atlassian Cloud Limitations</h2> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="672" height="1024" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-672x1024.jpg" alt="" class="wp-image-79" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-672x1024.jpg 672w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-197x300.jpg 197w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-768x1170.jpg 768w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-1008x1536.jpg 1008w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-1344x2048.jpg 1344w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_264365357-scaled.jpg 1680w" sizes="(max-width: 672px) 100vw, 672px"></figure> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>We have grouped the differences between Server and Cloud into the following categories:</p> <ul><li>System Level</li><li>User Related Actions</li><li>JQL Function Limitations</li><li>ScriptRunner Features</li></ul> <p>For each category we will outline the features that are not currently supported in ScriptRunner for Atlassian Cloud.</p> </div> </div> <h3 class="wp-block-heading">System Level</h3> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-3 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>System Level features are related to database connections, mail handlers, server logs, and system configurations. At this time the Jira Cloud API does not offer the same low-level access as Jira Server and this limitation affects the following ScriptRunner system level features:</p> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="1024" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-1024x1024.png" alt="" class="wp-image-80" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-1024x1024.png 1024w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-300x300.png 300w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-150x150.png 150w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-768x768.png 768w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-1536x1536.png 1536w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1645966345-2048x2048.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px"></figure> </div> </div> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-4 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>Resources: Database Connection</li><li>Resources: Local Database Connection</li><li>Code Insights</li><li>Script Fields: Database picker</li><li>Script Fields: Remote issue(s) picker</li></ul> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>Re-index Issues</li><li>Built-In: View Server Log Files</li><li>Built-In: Configuration Exporter</li><li>Built-In: Copy Project</li><li>Built-In: Config Exporter</li></ul> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>Built-In: Copy Project</li><li>Built-In: Config Exporter</li><li>Built-In: Clear Groovy Classloader or Jira Internal Caches</li><li>Built-In: Configuration Exporter</li><li>Built-In: View Server Log Files</li></ul> </div> </div> <h3 class="wp-block-heading">User Related Actions</h3> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-5 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="738" height="738" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_266711807.png" alt="" class="wp-image-81" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_266711807.png 738w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_266711807-300x300.png 300w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_266711807-150x150.png 150w" sizes="(max-width: 738px) 100vw, 738px"></figure> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>Systems with managed accounts can connect to a User Directory (LDAP, etc.); however, functionality available for scripting user management in Cloud is very different than on Server. ScriptRunner for Server can interact with these types of integrations (LDAP integration points). Specifically, ScriptRunner for Server can:</p> <ul><li>Interact with LDAP connection resources</li><li>Connect picker fields to LDAP details (e.g. to select from a list of users)</li><li>Switch to a different user</li></ul> </div> </div> <p>None of the above is possible with ScriptRunner for Cloud. It is possible for a user to masquerade as another user if you have the right system permissions, but this is not something you can programatically do with ScriptRunner for Cloud.</p> <h3 class="wp-block-heading">JQL Functions</h3> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-6 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>ScriptRunner for Server can interact directly with JQL queries. This is NOT possible for Cloud. As a result, many of the custom JQL functions previously possible for Server cannot be replicated for Cloud. However, ScriptRunner (in the background) can augment Jira issues with extra attributes that you can query within JQL. For example, when sprint information is updated for a project, a ScriptRunner script can update issues asynchronously with a keyword nextSprint.</p> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="624" height="682" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_748886182.png" alt="" class="wp-image-82" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_748886182.png 624w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_748886182-274x300.png 274w" sizes="(max-width: 624px) 100vw, 624px"></figure> </div> </div> <p>The following are the JQL functions that are not currently available via the Jira Cloud REST API:</p> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-7 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>aggregateExpression</li><li>completeInSprint</li><li>earliestUnreleasedVersionByReleaseDate</li><li>hasRemoteLinks</li><li>inactiveUsers</li><li>incompleteInSprint</li></ul> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>jiraUserPropertyEquals</li><li>lastUpdated</li><li>linkedIssuesOfAll</li><li>linkedIssuesOfAllRecursive</li><li>linkedIssuesOfAllRecursiveLimited</li><li>linkedIssuesOfRemote</li></ul> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow"> <ul><li>myProjects</li><li>overdue</li><li>recentProjects</li><li>releaseDate</li><li>removedAfterSprintStart</li><li>startDate</li></ul> </div> </div> <h3 class="wp-block-heading">ScriptRunner Behaviours and Fragments</h3> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="472" height="512" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/innovation.png" alt="" class="wp-image-83" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/innovation.png 472w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/innovation-277x300.png 277w" sizes="(max-width: 472px) 100vw, 472px"></figure> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>The Behaviours feature included in ScriptRunner for Jira Server Behaviours provides more control over fields and their behaviours. This feature is not available for Cloud given the change in architecture and developer framework. It is not possible to interact and modify the UI in the same manner as with Jira Server, and this directly impacts manipulation of the Jira fields.</p> </div> </div> <p>The ScriptRunner for Server Fragments feature allowed scripts to inject UI components within specific places. In Jira Cloud, the Atlassian developer framework provides specific areas of the page (i.e. screen) where add-ons can present data (UI components). Script Fragments in ScriptRunner for Cloud can only inject html in the web panels.</p> <h2 class="wp-block-heading">Conclusion</h2> <p>This may sound like it’s all bad news. It isn’t. The changes that come with the shift to Atlassian Cloud provide many advantages and new opportunities for add-on app developers. Adaptavist, the developers of ScriptRunner, have summarized this best:</p> <blockquote class="wp-block-quote is-style-h3-blockquote is-layout-flow wp-block-quote-is-layout-flow"><p><em>As with most programming situations there are trade offs when writing scripts for both Cloud and Server and the limitations of Cloud are at the expense of stability and performance of the Atlassian application.</em></p></blockquote> <div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9 wp-block-columns-is-layout-flex"> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%"> <p>The good news is that Adaptavist is continuing to develop ScriptRunner for Atlassian Cloud products. At present, just over half of the features in ScriptRunner for Jira Server are supported in some capacity in ScriptRunner for Jira Cloud. Their status page suggests they aren’t finished with this work yet and more changes are expected.</p> </div> <div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%"> <figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="757" src="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1515834812-1024x757.png" alt="" class="wp-image-84" srcset="https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1515834812-1024x757.png 1024w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1515834812-300x222.png 300w, https://wordpress.highwaythreesolutions.com/wp-content/uploads/2021/07/shutterstock_1515834812-768x568.png 768w" sizes="(max-width: 1024px) 100vw, 1024px"></figure> </div> </div> <p>Furthermore, the lack of supported features from the server version does not mean you will lose half of your functionality by moving to the cloud. The missing features may not be ones you currently use. We recommend you take stock of your existing ScriptRunner scripts in use and review them with the functionality supported in ScriptRunner for Cloud to identify the impact on your team. As an Atlassian solutions partner, we are here to support you with this analysis – if you need support then contact us.</p> <p>If you would like to learn more about ScriptRunner, visit Adaptavist’s&nbsp;<a href="https://docs.adaptavist.com/?_ga=2.101774657.1335031310.1620160332-430693690.1618503562">new documentation site</a>&nbsp;or take a look at their&nbsp;<a href="https://scriptrunner.adaptavist.com/latest/jira/quickstart.html">previous location for documentation</a>&nbsp;for ScriptRunner up to version 6.20.0.</p>