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

Syntax

admUpdateCustomFieldOptions(fieldName, pathToFile, charset, actionForOldFieldValues, actionForExistingFieldValues, projectKeys, issueTypes, useDefaultScheme, reorder, updateExistingOptionsValues, applyActionsOnParentOptions)

...

If the project keys and issue types are not specified (empty arrays), the option will be added to the global context.
This routine only handles custom fields of the following types: single select, multi select, radio buttons and , checkboxes and cascading selects.

...

Parameter name

Type

Required

Description

fieldNamestringYesName of custom field.
pathToFilestringYes (can be empty string)

The path to a file to read options from.

If this parameter is empty, an empty list of options will be considered.

Note
iconfalse

The file should contain one custom field option on a separate line.


Note
iconfalse

To handle cascading select custom fields children options, prefix them with a space or a tab and they will be considered as children of the closest option from above that isn't prefixed with a space or tab.


charsetstringYes (can be empty string)

The character set to use when reading from file.

If this parameter is empty, then the default system charset will be used.

actionForOldFieldValuesstringYes (can be empty string)

The action to take for the field values (options) that are present in the current field options but are not present in the input options.

Possible values: "NONE", "DISABLE", "ENABLE", "DELETE".

If this parameter is empty, the value "NONE" will be used.

actionForExistingFieldValuesstringYes (can be empty string)

The action to take for the field values (options) that are present in the current field options and are also present in the input options.

Possible values: "NONE", "DISABLE", "ENABLE", "DELETE".

If this parameter is empty, the value "NONE" will be used.

projectKeysstring arrayYes (can be empty array)Project keys.
issueTypesstring arrayYes (can be empty array)Issue types.
useDefaultSchemebooleanYesSpecify if you want to use the default configuration scheme (or context) of this custom field.
reorderbooleanYesSpecify if you want to reorder the options as they are given in the input file.
updateExistingOptionsValuesbooleanYesSpecify if you want to update the existing options with the values provided in the input file. This option is needed because Jira considers for example that the option "ABC" is the same as "abc". This option allows you to rename the options.
applyActionsOnParentOptionsbooleanYes

Specify if you want the actionForOldFieldValues and actionForExistingFieldValues to also be applied to parent options, or just child options.

Note

If this parameter is false and the custom field's type is not cascading select, then the actions might will not apply (since only the cascading select custom field can have children displayed in the UI).


...

Code Block
Parent1(disabled)
 Child1(disabled)
 Child2(disabled)
 Child3
Parent2(disabled)
 Child4
 Child5
Parent3
 NewChild

Option "Parent2 - Child4" is going to be removed, because the actionForOldFieldValues parameter is "DELETE".

...


Example 2 - Updating other custom fields

Updating custom fields with types different than cascading select, works exactly the same, except the fact that the applyActionsOnParentOptions parameter should always be set to true.

The new option "PARENT1 - Child3" is added at the end of the existing options because the parameter reorder was set to false.

Example 2

Code Block
admAddCustomFieldOption("New Option", "Select List", "TEST", "Bug");

Add the "New Option" to custom field "Select List" with context for project "TEST" and issue type "Bug".

...

This is because these types of fields only use parent options (no child options).

That means that an example of the input file, "updateoptions.txt" could look something like this, for cascading select:

Code Block
Option 1
 Child option 1
 Child option 2
Option 2

 Child option 3
 Child option 4

and something like this for the other supported types (single select, multi select, radio buttons and checkboxes):

Code Block
Option 1
Option 2
Option 3


See also

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
cqllabel = "jira_field_routine"
labelsjira_attachment_routine

...