Need a custom field that updates the value with an +1 increment when new issue is created
eg - issue JIRA - 1 , field X value -1001, then when JIRA - 2 is created field x values automatically set to 1002 and so on
thanks
Create a text custom field (single line). In the example I added "Numbers" as field name. Then create a postfuntion with the script below.
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.jql.parser.JqlQueryParserimport com.atlassian.jira.web.bean.PagerFilterimport com.atlassian.jira.issue.fields.CustomFieldimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.issue.search.SearchProvider
// get all the used numbers so fardef query = ComponentAccessor.getComponent(JqlQueryParser).parseQuery("project = JA AND 'Numbers' is not EMPTY ORDER BY 'Numbers' DESC")def results = ComponentAccessor.getComponent(SearchProvider).search(query,ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(),new PagerFilter(1))int maxNumbers = 0CustomField cField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Numbers")
// get the highest used numberfor(Issue documentIssue: results.getIssues())
{ maxNumbers = documentIssue.getCustomFieldValue(cField) as Integer }// set the new numberdef newNumbers = ++maxNumbers as Stringissue.setCustomFieldValue(cField, newNumbers)
Hope this helps to anyone looking similar type of fields
There may be a plugin. However you need to refine the requirement. Is it by issue type, in project, issue type in project, or all of JIRA instance to find what you're looking for.
it is by issue in project. Lets say I create an issue with issue type feature, an the field X - will have 1001 (or any number) then the next issue in the same project (any issue type) it would get the field vale 1002 (1 value increment)
@Joe Pitt, Can you let me know the plugin that has this feature
No, I don't use one that does that. I just use jira suite utilities. Just search the marketplace. I know there are some out there that will increment an integer field.
It looks like you're new here. Sign in or register to get started.