How can I add custom fields available for "Sort By" in the Planning Board?

Hi guys,

We wish to sort cards in the planning board according to our own custom field, which we have developed. In order to do this, the user must first modify the context in the planning board and go to the "Sorting" tab (as show in pic 1). The problem is that the sorting tab only shows certain custom fields in the list, as I can not see our own custom field called "Sort Key" in this list.

The custom field we created is a very simple custom field and its purpose is to sort issues in order (in the issue navigator) with parents and subtasks underneath each other, regadless of when a subtask was created.

For example, if a user sorts the issue navigator by issue key, some of the subtasks would display later in the results, because the subtask was created much later (and thus receiving a bigger issue key). However, when issues are sorted according to our sort key, subtasks appear under the respective parent level issue (vice versa when order is DESC) regardless of when the actual subtask was created. The Sort key is a combination of the parent level issues key and a number value of the subtask's key.

Example: We have parent level issue FB42-12 which has a subtask FB42-21. FB42 is the key for our project. Sort key for the parent level issue is FB42-12 and for the subtask FB42-12-21.

The source code for this custom field is as follows:

package com.customer.jira.remark.plugin.customfield;

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.customfields.impl.CalculatedCFType;
import com.atlassian.jira.issue.customfields.impl.FieldValidationException;
import com.atlassian.jira.issue.fields.CustomField;

public class SortField extends CalculatedCFType {

    public String getStringFromSingularObject(Object arg0) {
        return null;

    public Object getSingularObjectFromString(String arg0)
            throws FieldValidationException {
        return null;

    public Object getValueFromIssue(CustomField cf, Issue issue) {
        String issueKey = issue.getKey();
        if (issue.isSubTask()) {
            String projectKey = issue.getProject().getString("key").toString();
            String parentKey = issue.getParent().getString("key").toString();
            return parentKey + issueKey.substring(projectKey.length());
        } else {
            return issueKey;


The question is, why does not the Custom Field show in the list in "Sort by" when editing the context?

Eric Salonen
Ambientia Ltd


5 answers

1 accepted

0 votes
Answer accepted


0 votes

You need to implement it as a sortable field.


public class SortField extends CalculatedCFType implements SortableCustomField {


public int compare(final Double customFieldObjectValue1, final Double customFieldObjectValue2, final FieldConfig fieldConfig) {

return customFieldObjectValue1.compareTo(customFieldObjectValue2);


The compare logic you do basically needs to return -1, 0 or 1, meaning a<b, a==b and a>b (I've cheated there - my data is numerics, so the compare function is a doddle)

Hi Nic,

Thanks for you reply mate. I completed the following function for implementing the SortableCustomField:

public int compare(final String customFieldObjectValue1, final String customFieldObjectValue2, final FieldConfig fieldConfig) {
return customFieldObjectValue1.compareTo(customFieldObjectValue2);

Is this correct? The field is still not visible in the Sort By view in GreenHopper.

Any help still left?

Hi everybody,

Is there anybody that con confirm my question above?


Does it implement "sortable field" as well? That's worked for my code, I don't know if there's something else I've missed.

Hi Nic,

Thanks for the reply, yes it does implement the Sortable field as well, same way as in your example. Hmmm, I wonder what it might be....

Hi guys,

I would really love to get an answer for this question as it is baffling me quite a bit? Any help from the internets people?

Eric Salonen

Hello there.

Have you tried re-indexing?

I think sorting might be also connected to search index. Try setting a search template to the custom field (edit custom field in the administration section) and re-index again.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Feb 26, 2019 in Jira Software

How to prevent the propagation of unused project schemes, workflows & screens in Jira software

Atlassian ranks project attributes as the third most important factor impacting performance in the category of data. It’s not surprising, since project attributes are precisely the rules used to ma...

635 views 0 7
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