Custom Issue ID Generation

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?


1 answer

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)

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

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
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,346 views 13 19
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you