admUpdateCustomFieldOptions

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

Important changes starting with SIL Engine v 5.8.0.4

It was discovered that, in some cases, the routine was introducing some inconsistencies regarding the field configurationā€™s applicable project/issue types and their options. Therefore, some updates were made to deal with this issue.

The custom field options update is now performed only when there is a 100% match between the provided Project Keys/Issue Types pair and an existing context. If there isnā€™t such a match, a check is made to see if the creation of a new context is possible (without interfering with the existing contexts).

If the check passes, a new context is created and the updates are performed on this newly created context.

If not, the routine simply returns ā€˜falseā€™ and no updates are performed.

As a result of these changes, the ā€˜useDefaultSchemeā€™ parameter was removed because it became obsolete.

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 - Updating a Cascading Select Custom Field

For Example 1.1 and Example 1.2 we will consider as a starting point, the following already existing options of the custom field:

Parent1 Child1 Child2 Parent2 Child4

and as an input file, "updateoptions.txt", that has the following contents:

PARENT1 Child3 Child2 CHILD1 Parent2 Child5 Parent3 NewChild

Example 1.1. - Updating a Cascading Select Custom Field - Delete missing input options, rename existing input options

Option "Parent2 - Child4" is going to be removed, because the actionForOldFieldValues parameter is "DELETE".
Option "Parent1 - Child1" will be renamed to "PARENT1 - CHILD1" because the parameter updateExistingOptionsValues is 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.

admUpdateCustomFieldOptions("CF _CASCADE", "updateoptions .txt", " ", "DELETE", "NONE", {}, {}, false, true, false);

The resulted field options will now be:

Example 1 - Updating a Cascading Select Custom Field

For Example 1.1 and Example 1.2 we will consider as a starting point, the following already existing options of the custom field:

and as an input file, "updateoptions.txt", that has the following contents:

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.

See also