How Jira selects the default priority for the issue even when default priority is set to None?
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Many times users will notice that the priority is filled automatically when the user tries to create the issue. Also, even when the Priority
field is not present on any of the issue screens and if the user tries to create the issue the Priority field is still displayed on the newly created issue. Until and unless the priority field is present on the field configuration used by the Project, the field will be displayed on the issue.
Solution
If the default priority scheme of the project is defined, the priority will be selected by default at the time of the issue creation.
If the priority field is not present on the screen and under the priority scheme of the project, the default priority is set to None and then if the user tries to create the issue, Jira will still fill the priority on the newly created issue. It may seem like, Jira is filling the priority randomly. It is not the case, Jira follows a certain behavior while setting the priority on the issue.
It sets the priority which lies in the middle of the priorities sequence defined in the Priority scheme.
The code that does this is as below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public Priority getDefaultPriority() {
final String defaultPriorityId = (ComponentAccessor.getApplicationProperties()).getString(APKeys.JIRA_CONSTANT_DEFAULT_PRIORITY);
if (defaultPriorityId == null) {
final Collection<Priority> priorities = getPriorities();
Priority defaultPriority = null;
final Iterator<Priority> priorityIt = priorities.iterator();
int times = (int) Math.ceil((double) priorities.size() / 2d);
for (int i = 0; i < times; i++) {
defaultPriority = priorityIt.next();
}
return defaultPriority;
} else {
return getPriorityObject(defaultPriorityId);
}
}
So, if the total number of priorities in the priority scheme is 7 (odd number), the priority that comes in the middle is ceil(7/2)=4. Similarly, if total priorities are 6, then it will be 3. So, in that case, 3rd priority from the top will be selected as the default.
Was this helpful?