Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,793
Community Members
 
Community Events
185
Community Groups

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

Siavosh Kasravi
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.
Oct 11, 2020

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

0 votes
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 12, 2020

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

Siavosh Kasravi
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.
Oct 12, 2020

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

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 13, 2020 • edited

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
AUG Leaders

Atlassian Community Events