Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4892

Script Field does not sort properly in Issue Navigator



    • Bug
    • Status: Done
    • Low
    • Resolution: Rejected
    • 6.13.1
    • None
    • Script Fields
    • None
    • SR4J Sprint 107, SR4J Sprint 108, SR4J Sprint 109
    • 7



      When the Search Template for a Script Field that displays number is set to 'Number Searcher', the field doesn't sort properly in the Issue Navigator. When the Search Template is set to 'None', it gets sorted correctly.

      Steps to Reproduce the Problem

       If you don't have a sample project yet, create a new one and create a number of test issues.

      1. gg > input 'Script Fields' > enter
      2. Click on 'Create Script Field' > choose 'Custom Script Field'
      3. Fill in the Field Name e.g. "Subtask Number" > set the 'Template' to 'Number Field'
      4. Place this sample script in the inline editor 
        return issue.subTaskObjects.size() as Double
      1. Click on 'Add' to save
      2. Configure Screens > select applicable screens for your project > click on 'Update'
      3. gg > input 'Custom fields' > enter
      4. Look for 'Subtask Number' > Actions > Edit > set the 'Search Template' to 'Number Searcher' > Update
      5. Click on 'Issues' tab on the top menu bar > 'Search for issues'
      6. On the Issue Navigator screen, set the view to 'List View'. Switch to Advanced search.
      7. Click on 'Columns' > input "Subtask Number" and check the box > click 'Done'
      8. On each of the created test issues, create a number of subtasks. You'll see a list of issues with random number of subtasks at the end of this step.
      9. Click on the 'Subtask Number' column to sort in ascending and descending order. Note that the numbers do not sort correctly.

      Note: When you're searching the issues with a much more specific query i.e. project = projectname AND type != Sub-task ORDER BY cf[xxxxx] ASC/DESC as opposed to just searching by ORDER BY cf[xxxxx] ASC/DESC, the script field can sometimes appear to be sorted correctly. In this situation, create a new test issue and sort again. It might sort correctly or otherwise - the sorting behaviour is observed to be inconsistent.

      Expected Behaviour

      Script Field should sort correctly in the Issue Navigator with 'Search Template' set.

      Actual Behaviour

      Script Field doesn't sort correctly in the Issue Navigator when the 'Search Template' is set with a custom field searcher e.g. 'Number Searcher'.


      Set the 'Search Template' for the Script Field to 'None'.

      This would render the Script Field unsearchable but sortable.

      Additional Info

      • In screen recording Screen Recording 2020-11-29 SRJSUP-16913.mov, the sorting for 'Subtask Number' script field doesn't work in ascending order while it appears to be working in descending order.
      • However, in this screen recording Screen Recording 2020-11-25 Customer's Example.mov which mimics the customer's setup, the sorting for 'Anforderungstests' script field appears to work in ascending order but failed to work in descending order. It takes setting the Search Template to 'None' for the script field to sort correctly.


        1. 2020-11-29_11-14-39.png
          429 kB
          Winnie Koh
        2. 2020-11-29_11-17-39.png
          437 kB
          Winnie Koh
        3. 2020-11-29_11-18-10.png
          458 kB
          Winnie Koh
        4. project-x-issues.png
          118 kB
          Winnie Koh
        5. Screen Recording 2020-11-25 Customer's Example.mov
          16.94 MB
          Winnie Koh
        6. Screen Recording 2020-11-29 SRJSUP-16913.mov
          55.59 MB
          Winnie Koh
        7. Screenshot 2021-09-02 at 15.09.54.png
          8 kB
          Joe Baldwin
        8. Screenshot 2021-09-02 at 15.15.12.png
          17 kB
          Joe Baldwin
        9. Screenshot 2021-09-02 at 15.16.32.png
          54 kB
          Joe Baldwin
        10. script-field-sorting-free-text-searcher.png
          156 kB
          Winnie Koh



            jechlin Jamie Echlin
            wkoh Winnie Koh
            4 Vote for this issue
            11 Start watching this issue