Forums

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

Using scriptrunner or jira core, create a static global value for counting

n0manarmy November 23, 2020

I've modified my summary field to include the project key, year, and I want a rolling counter as all issues are created.

I can't seem to find an ideal way to store a global value that all issues within my project can pull from and increment.

Essentially I want to create something similar to the list below. I could create a custom entry in a database and potentially access that field with scriptrunner, but I want to keep as much as I can within the core of scriptrunner and jira core to avoid having too much of a home rolled system.

PROJ-2019-0001...PROJ-2019-3142, PROJ-2019-3143
PROJ-2020-0001, PROJ-2020-0002...PROJ-2020-XXXX

1 answer

1 accepted

0 votes
Answer accepted
Nic Brough -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.
November 23, 2020

That's an ugly misuse of the summary field, but I'm sure you have some justification for it.

I would not try to do this with a variable, you are probably going to find it does "interesting" things due to the way Jira does things internally.

I am also unsure of what use such a global value would be, all I can think of is "number of issues we've created", but you can get a more useful number by simply asking how many issues are returned by a query for everything (or with SR, pull the number from the system information page)

If you just want a numeric unique id as an alternative for issues, you can easily get to the issue id (it's the id in the jira issue table)

n0manarmy November 23, 2020

I had thought about that too. We're coming from a legacy system where there was very "blunt" ways of doing things, like adding counters to issues because we couldn't do simple actions like "Search all issues created within this year" easily.

The workforce has requested features like this because this is what they know. I'll work with the issue id for now and see if we can change this via culture.

Like Dave Liao likes this
Nic Brough -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.
November 23, 2020

Good to hear - "we used to do it that way" is probably a good way to start process improvements - you did it that way because the tool was clumsy.  Now you've got a better one, it's worth a look at using it better to support your desired ways of working!

The raw issue id in the database is not sequential, but it will increment with each issue (so you know issue 123456 was created after 123455), and you won't get the problems you might have with a variable.  With scriptrunner, you can easily get to it with issue.getId()

Like Dave Liao likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events