Custom Issue ID Generation

Ben Damonte October 26, 2015

We are in the process of migrating to JIRA. I am trying to find a way to use a custom field to tie JIRA to our legacy systems and processes.

Our scheme for issue IDs has historically been something like:

  • pppp-Tiiii
    • where: 
    • pppp is a four digit numeric project ID.
    • T is a letter indicating the issue type 
      • ('S' for software, 'D' for documentation, etc)
    • iiii is a four digit sequential issue number with leading zeros 
      • Each issue type has its own number series 
      • (i.e. S0001 and D0001 are different, unrelated issues)

I understand that JIRA will internally use its own key for each issue, but our team will need to continue using our legacy ID format.

When a new issue is created, I want to have the tool automatically generate the next number for the appropriate issue type.

I have found several plugins that can populate a string in a custom field, but they appear to operate on data that already exists in other fields.  Is there a way that I can have a counter for each issue type that will increment whenever a new issue of that type is created?

With this field, I believe I can concatenate data into a unique ID for each issue. 

Or, is there an easier way?

 

2 answers

0 votes
LP March 24, 2021

@Ben Damonte Did you ever work this out? I am trying to achieve the same thing by generating a custom plugin. I would like to avoid using scriptrunner

0 votes
GabrielleJ
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.
October 26, 2015

You can the use post-function in the "Create" transition named "Update parameters of the Set Field Value to constant or Groovy expression Function for this transition." or "Scripted field" using the JIRA ScriptRunner. Your groovy code will have to concatenate and parse the current JIRA Project ID, Issue type and a code to get the project's issue counter in the database (very hard and nearly impossible)

Ben Damonte October 26, 2015

Thank your for the response. I understand the basics of how this would be implemented (custom fields with post-function invoked scripts). I am trying to find some more information on what specifically the script would need to do. Can you point me to any documentation on JIRA's scripting API or database implementation? Are you saying that it is nearly impossible to access JIRA's internal issue counter? If it really is that difficult, I suppose we could add our own issue counter to the database. Again, I would need some documentation on the database implementation itself. Thanks again

GabrielleJ
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.
October 27, 2015

I have not done anything like it so I can't suggest anything that gets information from a database (it's too tedious, you will need another tool to connect to the database that can work with your preferred language). If I really really need to implement this, at the top of my mind, I will use a shell script called in a post-function of the "Create" event. This shell script of mine will call the 'sqlplus' bin that I am using to connect to any database for any automation. Then update the existing ticket with the number.

Suggest an answer

Log in or Sign up to answer