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

Issue Incramentation

If I create new Issue by create button on create screen I must take Issue Id to field in Create screen. How could I tae Isue Id ? Which could be incremented ? Please help.

1 answer

1 accepted

1 vote
Answer accepted

I am sorry, I do not understand the requirement here.

When you create a JIRA issue, it creates a new, unique ID for it. 

I think that's clear, but where I'm lost is "How could I tae issue id?"  - what do you mean by that?  And what are you trying to increment?

Hello Nic. In creation Screen I want to see Custom field with created Issue Number. I could Incrametate this Issue_Id=issue_Id +1, but first of all I should have got any Issue Id Last to Incremetate it by 1.

First, what do you mean by "created issue number"? Let's say you create a new issue with a key of ABC-123 - do you mean the full key ABC-123, just the numeric part 123, or possibly the immutable ID value in the database (will be a 5 or more digit number)? Second, the easy part - once we know what number you are working with, I'd write a scripted field (in the script runner) that displays that number +1. There are some other options like a little bit of code to add one and just put that in a custom field, and there are scripting add-ons other than script-runner. A scripted field has the advantage that if you're looking at the Key, it will still work if you move the issue. I.e. when you create ABC-123, it will show 124, and if you then move the issue to XYZ and it becomes XYZ-456, the field will show 457. If you actually want to keep the 124, you'll need it posted into a custom field though. I think it might be worth explaining why you want this field though - it sounds utterly useless, which makes me suspect you're trying to solve a real problem in a really bad way. What's the actual problem this solves?

In ID i want only numer field only 123. It Can be 5 digit numer, but I want it unimited starting from "1". But I cant use script-runner, because in my company they don't buy him. It's to expensive. And I must use native Jira solutions. I can do bit of code, but how get issue numer ? :) But when I creating Issue I havent got issue Key yet? Or i don't know something ? In sharepoint I was getting max id ang giving + 1 and was getting creating new element ID? Could I do it in Jira ? How ? :) Please help. In all project in my Company they want have ID field. Because this could unically say about Issue in the project.

Ok, the requirement is just silly. Tell them to use the JIRA Issue key. They already have that, and its unique in the project so the new field is a total waste of time. If they insist on wasting your time, then you can use a post-function, listener or scripted field. You don't get the issue key until the issue is created because JIRA *cannot* know what the next number is going to be until it's taken a lock on the number and is definitely going to create it. In a listener though, the "issue created" event will have the JIRA key, and a scripted field will display it too, as it is generated after the issue is created. Same for a post-function, the key will be there.

And Nic have youcnow any posted function to use it on it. How could use a listener ? Have you know any tutorial which could Teach how to use a listener ?

No, I've never written anything like this (because it's a total waste of time) A listener is more complex to code than a post-function, I'd start with one of those.

And two or 3 sample of writing post function ? Please Nic.

It would be better that you understand the full process. Your code doesn't need to be at all complex, but it's worth seeing the full process - see

Thanks Nic. I will try :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,652 views 11 5
Join discussion

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