Forums

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

How to deploy Script Runner groovy script "Save a comment draft automatically in Jira"

Michael S Yecies October 23, 2018

Hi Everyone,


Script Runner has started to collect and share scripts for general use through their new Adaptavist Library service: https://library.adaptavist.com/

There is a script in the Adaptavist Library service which I would like to make use of in order to improve my end-user's experience of working with Jira (1000 users). 

The purpose of the Adaptavist script is to save a draft of a comment (local to the user's session) so that in the case of web page refresh the Jira Issue comment is not lost... which definitely happens from time to time when a User is working with Jira in a high volume usage pattern for their day to day work.

Where do place the script Save a comment draft automatically in Jira in the Script Runner App in order to make use of this script (and other similar scripts)? 

I am new to using Script Runner in this manner.

Script Runner is running in Jira (licensed).

Thank you in advance for your advice and help.

Michael

1 answer

0 votes
Joshua Yamdogo @ 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.
October 24, 2018

Hi Michael,

I believe that JavaScript would be used as a Script Fragment, specifically a Web Resource. 

Let me know if you can get it working as a web resource.

Regards,

Josh

Michael S Yecies October 25, 2018

Hi Josh, 

Thank you for the reply... however we are not there yet. 

The information in the Adaptavist Script Library can definitely be improved... Presumably the purpose of the new Adaptavist Script Library is to help your customers and potential customers learn about how to gain far deeper control and customization of their Atlassian applications... However, your Adaptavist documentation needs to be accessible to a broader range of people not just people who are [Atlassian development experts + Adaptavist Script Runner experts + Groovy / JavaScript experts].  Though I certainly aspire to become an [Atlassian development expert + Adaptavist Script Runner expert + Groovy / JavaScript expert].

 

Additional Questions about implementing the Script Fragment -> Web Resource:

  • Context(s) -
    • What context is valid here? I have Atlassian Stack full integrated.
      • The list of available Contexts is very, very long. 
      • I have users working in both Jira Service Desk and Jira core / software modes.
    • Is there better documentation about what values are appropriate in a general sense?
  • Key -
    • What value is appropriate here?
    • Is there better documentation about what values are appropriate in a general sense?
      • This is not so helpful https://developer.atlassian.com/server/jira/platform/web-resource/ 
        • The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.
          <component-import key="appProps"
          interface="com.atlassian.sal.api.ApplicationProperties"/>

          In the example, appProps is the key for this particular module declaration, for component-import, in this case.

          That is, the identifier of the web resource.

image.png

Michael S Yecies October 25, 2018

Hi Josh,

Using the following values (chosen as a best guess as the documentation was not clear / clearly available):

  • Note:  Save a comment draft automatically in Jira local session
  • Context(s):  jira.view.issue
  • Key:  comment.draft.content

 

Returns the following errors in my Script Runner Install web resource UI:

  1. (!) You need to configure at least one alternate resource directory before using a web-resource, see the documentation
  2. image.png
  3. Could not find <tt>})(AJS.$);</tt> in configured resource directories:

What do I need to do to make this Adaptavist script work in my Jira Data Center deployment?

Thank you.

- Michael

Suggest an answer

Log in or Sign up to answer