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?
Cheers,
Eric Salonen
Ambientia Ltd