Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What are the ways to store value (variables) persistently in groovy?

I know about 

import com.onresolve.scriptrunner.runner.util.OSPropertyPersister

def pluginSettings = OSPropertyPersister.getPluginSettings()

def key = "key"
def value = "my-value"

// save value against key
pluginSettings.put(key, value)

// retrieve value for key
def savedValue = pluginSettings.get(key)

But is there any other way to store data for later use in scripts? For example suppose I have a counter which is incremented for a specific kind of issue and I want to read it later...

 

1 answer

Hi there,

I presume this data you wish to store is not in context of An issue or A project, but rather for the whole instance?

In that case, have you considered adding a table tot the Jira (or other accessible) database?

From groovy you could then access this data, this KB article should help you on your way:
https://scriptrunner.adaptavist.com/4.3.4/jira/recipes/misc/connecting-to-databases.html

Let me know if this helps!

 

Regards,

Jeroen

This is exactly what I am looking for. Is there a suggested way or guideline to add tables tot Jira database?

Hi,

Just creating tables in the Jira DB is strongly discouraged, since Jira will probably ignore these tables during upgrades etc ...
https://community.atlassian.com/t5/Jira-Core-questions/How-to-insert-a-custom-table-to-JIRA-DB/qaq-p/424568

A few options:

 

Regards,

Jeroen

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Introducing External Collaboration for Confluence

We’re excited to introduce external collaboration for Confluence, now available in early access. It is available to preview for Confluence Cloud Premium and Enterprise customers. (If you're not on ...

214 views 0 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you