Filtering and grouping tasks by states does not work with a large number of state choices


If you have a large number of custom states for task and extensions of task, the following issues occur when you try to construct a custom filter based on the state:

1. The list of states appears random, so it can be difficult to find your choice.
2. The list is incomplete and your choice may not be available for selection.

Group the list of all tasks by state. If your desired state did not appear as a choice when you were trying to create the filter, it will not appear as a group in this list either.

If you filter on a particular task type and then group by state, all of the desired states appear as grouping values, including the ones that did not display with filtering or grouping on the entire list.

Steps to Reproduce



  1. Go to your choice list and delete all existing choices for the element state where the name is one of the following: (change_phase, change_request, change_request_imac, change_task, chat_queue_entry, incident, kb_submission, planned_task, pm_project, pm_project_task, problem, problem_task, release_phase, release_task, rm_defect, rm_doc, rm_enhancement, rm_epic, rm_feature, rm_product, rm_release, rm_release_phase, rm_release_scrum, rm_release_sdlc, rm_scrum_task, rm_sprint, rm_story, rm_task, rm_test, sc_req_item, sc_request, sc_task, sysapproval_group, task,ticket).
  2. Import the attached XML file of sys_choice records.
  3. Navigate to Scripts > Background and paste the JavaScript in the attached PRB584352 Data Builder JS.txt file, and click the Run Script button.
  4. Navigate to task.list.
  5. Use the filter wizard and try to specify [State] is [Requestor Production Verification].
    It is not an available choice for State, even though it is a valid state for Enhancements and Defects, and there is one of each of these present.
  6. Group this task list by State.
    Note that you will not see Requestor Production Verification in your groups in your list.
  7. Filter by [Task Type] is [Enhancement] or [Task Type] is [Defect].
    Note that you will have a group for Requestor Production Verification with two records in it (1 enhancement, 1 defect).


The filter below can be used to retrieve all the available [sys_choice] values stored in the instance for task related tables:


SN Administrators should monitor the existing values before initiating any maintenance to state values.

The order of the state fields that show up in the filter may appear random, but they actually follow these rules:

  1. All the sys_choice options for the base table come first.
  2. It will not add duplicate values for the sys_choice.value field.
  3. Choices are ordered by sequence, then by label.
  4. Only choices where inactive = false are included.
  5. After all the base tables are added, all the options for the extended tables are added.
  6. Extended tables are added one table at a time.
  7. Extended tables follow all the same rules as (2 through 4).

Related Problem: PRB584352