---
title: "admUpdateCustomFieldOptions"
canonical: "https://support.appfire.com/space/PSJ/15489437/admUpdateCustomFieldOptions"
format: markdown
---
> Macro (aura-html)


|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | admUpdateCustomFieldOptions(fieldName, pathToFile, charset, actionForOldFieldValues, actionForExistingFieldValues, projectKeys, issueTypes, ~~useDefaultScheme,~~ reorder, updateExistingOptionsValues, applyActionsOnParentOptions) | **Package** | adm |
| **Alias** |  | **Pkg Usage** | updateCFOptions(fieldName, pathToFile, charset, actionForOldFieldValues, actionForExistingFieldValues, projectKeys, issueTypes, ~~useDefaultScheme,~~ reorder, updateExistingOptionsValues, applyActionsOnParentOptions) |

## Description

> Macro (excerpt)
> 
> Updates custom field options for the specified context. If the context does not exist, it will be created.

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 function 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 function 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 function simply returns ‘false’ and no updates are performed.
> ⚠️ 
> ⚠️ As a result of these changes, the ‘useDefaultScheme’ parameter was removed because it became obsolete.

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| fieldName | String | Yes | Name of custom field. |
| pathToFile | String | No | The path to a file to read options from.<br>If this parameter is empty, an empty list of options will be considered.<br>> ⚠️ The file should contain one custom field option on a separate line.
> ⚠️ 
> ⚠️   
> ⚠️ 
> ⚠️ 
> ⚠️ > Macro (legacy-content)
> ⚠️ 
> ⚠️ 
> ⚠️ charset
> ⚠️ 
> ⚠️ String
> ⚠️ 
> ⚠️ No
> ⚠️ 
> ⚠️ The character set to use when reading from file. If this parameter is empty, then the default system charset will be used.
> ⚠️ 
> ⚠️ actionForOldFieldValues
> ⚠️ 
> ⚠️ String
> ⚠️ 
> ⚠️ No
> ⚠️ 
> ⚠️ 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.
> ⚠️ 
> ⚠️ actionForExistingFieldValues
> ⚠️ 
> ⚠️ String
> ⚠️ 
> ⚠️ No
> ⚠️ 
> ⚠️ 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.
> ⚠️ 
> ⚠️ projectKeys
> ⚠️ 
> ⚠️ String []
> ⚠️ 
> ⚠️ No
> ⚠️ 
> ⚠️ Project keys.
> ⚠️ 
> ⚠️ issueTypes
> ⚠️ 
> ⚠️ String []
> ⚠️ 
> ⚠️ No
> ⚠️ 
> ⚠️ Issue types.
> ⚠️ 
> ⚠️ ~~useDefaultScheme~~
> ⚠️ 
> ⚠️ ~~Boolean (true/false)~~
> ⚠️ 
> ⚠️ ~~Yes~~
> ⚠️ 
> ⚠️ ~~Specify if you want to use the default configuration scheme (or context) of this custom field.~~
> ⚠️ 
> ⚠️ reorder
> ⚠️ 
> ⚠️ Boolean (true/false)
> ⚠️ 
> ⚠️ Yes
> ⚠️ 
> ⚠️ Specify if you want to reorder the options as they are given in the input file.
> ⚠️ 
> ⚠️ updateExistingOptionsValues
> ⚠️ 
> ⚠️ Boolean (true/false)
> ⚠️ 
> ⚠️ Yes
> ⚠️ 
> ⚠️ Specify 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.
> ⚠️ 
> ⚠️ applyActionsOnParentOptions
> ⚠️ 
> ⚠️ Boolean (true/false)
> ⚠️ 
> ⚠️ Yes
> ⚠️ 
> ⚠️ 
> ⚠️ Specify if you want the **actionForOldFieldValues** and **actionForExistingFieldValues **to also be applied to parent options, or just child options.
> ⚠️ 
> ⚠️ > Macro (legacy-content)<br>## Return Type<br>**Boolean (true/false)**<br>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.<br>## Examples<br>### Example 1 - Updating a Cascading Select Custom Field<br>For **Example 1.1** and **Example 1.2** we will consider as a starting point, the following already existing options of the custom field:<br>```
Parent1
 Child1
 Child2
Parent2
 Child4
```<br>and as an input file, "updateoptions.txt", that has the following contents:<br>```
PARENT1
 Child3
 Child2
 CHILD1
Parent2
 Child5
Parent3
 NewChild
```<br>### Example 1.1. - Updating a Cascading Select Custom Field - Delete missing input options, rename existing input options<br>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.<br>```
admUpdateCustomFieldOptions("CF _CASCADE", "updateoptions .txt", " ", "DELETE", "NONE", {}, {}, false, true, false);
```<br>The resulted field options will now be:<br>```
PARENT1
 CHILD1
 Child2
 Child3
Parent2
 Child5
Parent3
 NewChild
```<br>### Example 1 - Updating a Cascading Select Custom Field<br>For **Example 1.1** and **Example 1.2** we will consider as a starting point, the following already existing options of the custom field:<br>```
Parent1
 Child1
 Child2
Parent2
 Child4
```<br>and as an input file, "updateoptions.txt", that has the following contents:<br>```
PARENT1
 Child3
 Child2
 CHILD1
Parent2
 Child5
Parent3
 NewChild
```<br>```
Option 1
 Child option 1
 Child option 2
Option 2

 Child option 3
 Child option 4
```<br>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**.<br>## See also<br>> Macro (contentbylabel) |