I have a custom scripted field to count the number of issue links and dump the value into a custom field for the purposes of reporting. The goal is to be able to sort issues descending by the amount of linked issues.
This is my field code:
import com.atlassian.jira.component.ComponentAccessor
a = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter).getAllIssues().size()
a.toString()
Everything works as expected except when I sort. I have one issue with 34 links, and it comes WAY down in the list after issues that only have 1 or 2 links.
What I can observe happening, is that Jira is sorting by the first digit only. For example, sorting by this field DESC yields the following pattern:
14
10
1
1
22
2
2
34
3
31
as an example.
Your field output is not a number, it's a string. To fix it:
Thank you Nic! I had the first bullet done, but not the second. Once I did that and re-indexed, everything was perfect!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nic,
I have configured my Scripted field as number ,but still it doesnt sort properly. What needs to be done now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Commenting late for anyone who still faces this issue but potentially misses what Nic referred to relating to the Searcher type above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.