Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info
titleAvailability

This routine is available starting with SIL Engine™ 4.8.0.7.

Syntax

...

Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

admSetCustomFieldOptionEnabledState(fieldName, fieldOption, projectKeys, issueTypes, useDefaultScheme, enableOption)

Package

adm

Alias

Pkg Usage

setCFOptionEnabledState(fieldName, fieldOption, projectKeys, issueTypes, useDefaultScheme, enableOption)

Description

Excerpt
hiddentrue
Updates the enabled/disabled state of a specific custom field option for the specified context.

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 checkboxes and cascading selects.

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

fieldName

...

String

Yes

Name of custom field.

fieldOption

string or string array

Yes

The field option that will be enabled or disabled.

...

iconfalse

To handle cascading select custom fields children options, use string array, and fill the first array position with the parent field option, and the second one with the child field option.

projectKeys

...

String []

Yes

...

Project keys. An empty array can be passed for this parameter.

issueTypes

...

String []

Yes

...

Issue types. An empty array can be passed for this parameter.

useDefaultScheme

...

Boolean (true/false)

Yes

Specify if you want to use the default configuration scheme (or context) of this custom field.

enableOption

...

Boolean (true/false)

Yes

Specify if you want the option to be enabled (set as true) or disabled (set as false).

Return

...

Type

boolean 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.

...

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.

Code Block
admSetCustomFieldOptionEnabledState("CF_CASCADESINGLE_SEL", {"parent", "child"}, {}, {}, false, false);

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.

Code Block
admSetCustomFieldOptionEnabledState("CF_CASCADESINGLE_SEL", "parent", {}, {}, false, false);

Note

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

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "jiracustomfield_fieldadmin_routine" and space = currentSpace ( )
labelsjiraarray_attachment_routineroutines