Is there a place I can store reusable code?

Brandon Lawler April 30, 2019

Hi all,

I'm using Scriptrunner for Jira Cloud. I have built out several functions that I will be using in multiple listeners and I would like to avoid repeating them if possible. Is there a place where I can store shared code? (Example: I have a reporting function that integrates with an external system via direct URL parameters, and I will be reusing this function in multiple listeners.)

I have seen solutions for this that run on Jira Server, but not Jira Cloud.

1 answer

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2019

Hi Brandon,

Thank you for your question.

I can confirm that currently it is not possible to re use code across multiple functions inside of ScriptRunner for Jira Cloud and that you can see more detailed information about why this is not possible inside of the knowledge base article located here.

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.

Regards,

Kristian

Brandon Lawler May 7, 2019

Thanks Kristian! One more question: is it possible to run an arbitrary string as code, including function definitions? I have created a workaround for not being able to store configuration files (e.g. CSVs with data) by creating a "CONFIG" project and storing the text of those files as descriptions in special "issues" that exist only to house that data. If I could also write code and store them in descriptions, then use scriptrunner to retrieve and execute those descriptions as code directly, that would allow me to reuse code. To do that, I would need a way to run the string and have it call directly.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events