Skip to end of banner
Go to start of banner

admUpdateCustomFieldOptions

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Availability

This routine is available starting with SIL Engine™ 4.6.3.

Syntax

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

Description

Updates custom field options 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 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.


Parameters

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.

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


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 change the case of the options.
applyActionsOnParentOptionsbooleanYes

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

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

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.


The new options in the input file that don't already exist in the custom field's options will automatically be added to the custom field's options.

Example

For the examples, the following file contents will be used:

Parent1
 Child1
 Child2
Parent2
 Child3

Add the "New Option" to the global context of custom field "Select List".

Example 2

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

If already exists a context for the specified project, but not for the specified issue type, the context will not be created.

See also


updatedoptions.txt

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


Example 1

  • No labels