admSetCustomFieldOptionEnabledState

Description

Updates the enabled/disabled state of a specific custom field option for the specified context. If the context does not exist, it will be created. If the project keys and issue types are not specified (empty arrays), the global context will be used. This routine only handles custom fields of the following types: single select, multi select, radio buttons, checkboxes and cascading selects.

Parameters

Return Type

Boolean (true/false)

Returns 'true' if the options were successfully updated and 'false' otherwise. If returned 'false' check the log for a detailed reason on why it failed.

Examples

Example 1 - Enabling a Single Select Custom Field option

The following line of code will enable the custom field option "myoption" from the single select field called "CF_SINGLE_SEL".

admSetCustomFieldOptionEnabledState("CF_SINGLE_SEL", "myoption", {}, {}, false, true);

Example 2 - Disabling a Single Select Custom Field option

The following line of code will disable the custom field option "myoption" from the single select field called "CF_SINGLE_SEL".

admSetCustomFieldOptionEnabledState("CF_SINGLE_SEL", "myoption", {}, {}, false, false);

Example 3 - Disabling a Cascade Select Custom Field child option

The following line of code will disable the custom field option "child" from the cascade select field called "CF_CASCADE". The "child" options is a sub-option of the "parent" option.

admSetCustomFieldOptionEnabledState("CF_SINGLE_SEL", {"parent", "child"}, {}, {}, false, false);

Example 4 - Disabling a Cascade Select Custom Field parent option

The following line of code will disable the custom field option "parent" from the cascade select field called "CF_CASCADE". Note that no child options will be disabled. but because the parent is disabled, the children will not show up either on the UI.

The disabled options are still visible on the issues where the custom field value has been set before the DISABLE operation took place. They will not show anymore on the new issues or issues that have ENABLED values set in the custom field.

See also