I have a file called helperfunction.groovy which have many functions. This file is used by many postaction scripts. In each of the scripts, I have imported the file and Used it like following :
//Import helper functions
File helperFunctionsFile = new File("/var/application-data/jira/postaction/HelperFunctions.groovy");
Class helperFunctionsgroovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(helperFunctionsFile);
GroovyObject helperFunctions = (GroovyObject) helperFunctionsgroovyClass.newInstance();
I would like to use this GroovyObject called helperFunctions in such a way that, it would be loaded during the startup of jira server and I can use it in any postaction scripts without reloading it. I want to use functions inside the file in as many postaction scripts as possible during the transition of issues from one transition to another.
Please clarify if you intend to do this for Jira Server / DC or Cloud.
If it's for Jira Server / DC, this is doable, but for Cloud, unfortunately, at present, this is not doable.
For Jira Server / DC, you can store your Groovy code in the /scripts folder, i.e. <JIRA_HOME>/scripts, e.g. /var/lib/atlassian/application-data/jira/scripts. Once the Groovy file is added to this folder, it can be accessed from any Post-Function or Workflow. Instead of using the Inline Editor, you need to use the File tab and specify the Groovy file you intend to use.
Unlike Jira Server / DC, where you can create offline Groovy files in the /scripts folder and reuse the same file in any workflow, for Jira Cloud, for now, you can only add the code via the Inline Editor.
Hence, you must add the code separately for each workflow using the Inline Editor.
Thank you and Kind regards,
Ram
Has your question been answered?
If yes, please accept the answer provided.
Thank you and Kind regards,
Ram
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As I already asked in my previous comment:-
Please clarify if you intend to do this for Jira Server / DC or Cloud.
Please clarify if you are using a Jira DC or Cloud.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.