This routine is available starting with SIL Engine™ 220.127.116.11.
admSetCustomFieldOptionEnabledState(fieldName, fieldOption, projectKeys, issueTypes, useDefaultScheme, enableOption)
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.
|fieldName||string||Yes||Name of custom field.|
|fieldOption||string or string array||Yes|
The field option that will be enabled or disabled.
|projectKeys||string array||Yes (can be empty array)||Project keys.|
|issueTypes||string array||Yes (can be empty array)||Issue types.|
|useDefaultScheme||boolean||Yes||Specify if you want to use the default configuration scheme (or context) of this custom field.|
Specify if you want the option to be enabled (set as true) or disabled (set as 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.
Example 1 - Enabling a Single Select Custom Field option
Example 1: The following line of code will enable the custom field option "myoption" from the single select field called "CF_SINGLE_SEL".
Example 2 - Disabling a Single Select Custom Field option
Example 2: The following line of code will disable the custom field option "myoption" from the single select field called "CF_SINGLE_SEL".
Example 3 - Disabling a Cascade Select Custom Field child option
Example 3: 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.
Example 4 - Disabling a Cascade Select Custom Field parent option
Example 4: 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.