ScriptRunner Issue Picker Field, Sort the selectable Issues on a Custom Field Value

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2023

We have a requirement to sort the displayed issues on a multiple issue picker field.

I've attempted adding the sort the customised JQL but still sorts be created / key with the newest at the top.

We are wanting to sort the displayed selectable issues on a custom field which contains numbers, so that the highest number is as at the top.

we already have the custom fields displayed.

renderOptionHtml = { String displayValue, Issue issue, Closure<String> highlight ->
    OutputFormatter.markupBuilder {
        i('Service Rank: ' + issue.getCustomFieldValue(OurFields.serviceRankField))
        mkp.yield(' - ')
        mkp.yieldUnescaped(displayValue)
    }
}

4 answers

1 vote
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2023

I would think you should be able to simply include "order by" in the JQL configuration of your issue picker field.

But I tested it and it doesn't work.

I don't think any of the customization options will let you affect the supplied list other than the JQL.

So you might need to contact adaptavist support to suggest this as a new feature (or perhaps a bug, I don't know why the order by clause in the JQL would be ignored).

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2023

@PD Sheehan 

Yes that was my first thought, also failed for me.

0 votes
Olly von Fay-Siebenburgen _ScriptRunner_
Contributor
January 29, 2024

Issue Picker fields can not be sorted unfortunately, there is a good explanation of why this is in our Documentation here, also we have further explanation in this Developer Ticket where the Devs explain why this has been removed: SRJIRA-5280.

You could create your own Issue Picker with the Custom Picker, but as soon as you start typing results to search, the results will also have your own custom sorting order applied which wouldn't be very useful.

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 6, 2024

@Olly von Fay-Siebenburgen _ScriptRunner_ 

Why would having our own sorting order being applied not be very useful?  It is our requirement to sort by a nominated field, with the highest value at the top.
i.e. Sorting issues in the order that they need to be worked

Rolf Lader
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 6, 2024

@Olly von Fay-Siebenburgen _ScriptRunner_ 

I can only agree with @David Harkins's reasoning. It makes no sense at all to make an Issue Picker field (or any other external field) non-sortable.

If there are technical reasons against sorting, then it is the task of software development to solve them and not to look for excuses why they don't want to do it.

Like David Harkins likes this
Olly von Fay-Siebenburgen _ScriptRunner_
Contributor
February 12, 2024

Apologies if I wasn't clear - if you apply your own sorting, then it will always apply this sorting method.

For example, if you want to sort by a nominated field, and you start searching for a specific issue, i.e. whenever you type anything into the search of the Issue Picker, it will always apply the sort to whatever you type. Essentially, it will render your searched query useless.

If you're not actually typing anything into the search bar of the Issue Picker, and you just want to see Issues with the highest value a custom field at the top (for example), then applying your own sorting method will be sufficient.

This was a deliberate decision to remove the sorting made by our Development team. Please see the comments made on our Issue discussing this by @Jamie Echlin _ScriptRunner - The Adaptavist Group_.

Like Rolf Lader likes this
0 votes
Rolf Lader
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 22, 2024

@David Harkins, have you submitted a support request to Adaptavist?

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2024

Yes this has been raised with Adaptavist

SRJSUP-33375

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2023

Hi @David Harkins

Could you please specify what version of Jira and ScriptRunner you are currently using?

Thank you and Kind regards,

Ram

David Harkins
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2023

Data Centre Installation

Jira Software 9.4.6

Jira Service Management 5.4.6

ScriptRunner: Installed version: 8.4.0

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events