Create a custom cascading dropdown field

Problem

When creating a predefined cascading select field, the option in the first dropdown list reflects the values available in the second dropdown list. However, in reporting, the values are combined into a single one. This can restrict the JQL used for filtering. Also, the field only allows users to select a single value in one or both fields.

Solution

You can solve this problem using Power Scripts™ Live Fields. For details on accessing the current screen with Live Fields, go to our documentation.

For the purpose of this example, consider a combination of two fields: Select List 1 (single choice) and/or Select List 2 (multiple choice). 

The fields have the following options:

Select List 1 (customfield_XXXXX)

Select List 2 (customfield_YYYYY)

Select List 1 (customfield_XXXXX)

Select List 2 (customfield_YYYYY)

  • Option 1

  • Option 2

  • Option 3

  • 1A

  • 1B

  • 1C

  • 2A

  • 2B

The below scripts configures the fields to allow for only the following option combinations:

  • 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"}); }

These scripts render the following result.