Issue Incramentation

Zawistowski Grzegorz October 16, 2015

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2015

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?

Zawistowski Grzegorz October 16, 2015

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2015

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?

Zawistowski Grzegorz October 16, 2015

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2015

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.

Zawistowski Grzegorz October 16, 2015

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 ?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2015

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.

Zawistowski Grzegorz October 16, 2015

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

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 16, 2015

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 https://developer.atlassian.com/jiradev/jira-platform/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/workflow-plugin-modules

Zawistowski Grzegorz October 16, 2015

Thanks Nic. I will try :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events