Create custom cascading select field

Required apps

Power Scripts™ for Jira v2.5.3+ (server)

Level: BASIC


The following problem can be solved by Live Fields, included in the Power Scripts™ for Jira app. Please also read the documentation regarding accessing the current screen with live fields.

Problem

The out of the box cascading select field does a great job creating a cascading field, in that the option of the first drop down reflects the values that can be selected in a second drop down. However, in reporting, the values are combined into a single value, which can restrict the JQL being used for filtering. Also, the out of the box field only allows for a single value to be selected and restricts the users ability to select multiple values in one or both fields.

Solution

Let's consider we have a combination of two fields of type Select List (single choice) and/or Select List (multiple choice). 

The fields have the following options

Select List 1 (customfield_XXXXX)Select List 2 (customfield_YYYYY)
  • Option 1
  • Option 2
  • Option 3
  • 1A
  • 1B
  • 1C
  • 2A
  • 2B

The following scripts will configure the fields so that the only the following combinations can be made:

  • Option 1
    • 1A
    • 1B
    • 1C
  • Option 2
    • 2A
    • 2B
  • Option 3


liveField.sil
lfInstantHook({"customfield_XXXXX", "customfield_YYYYY"}, "hook.sil");
lfWatch("customfield_XXXXX", {"customfield_XXXXX", "customfield_YYYYY"}, "hook.sil", {"change"});
hook.sil
string v = argv["customfield_XXXXX"];

if (v == "Option 1") {
    lfAllowSelectOptions("customfield_YYYYY", {"None", "1A", "1B", "1C"});
} else if (v == "Option 2") {
     lfAllowSelectOptions("customfield_YYYYY", {"None", "2A", "2B"});
} else {
     lfAllowSelectOptions("customfield_YYYYY", {"None"});
}

Result