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

## Description

> Macro (excerpt)
> 
> Update custom field options for the specified context (JProjectIssueTypes[]).

Update custom field options (JCustomFieldOption[]) for the specified context. If the context does not exist, it will NOT be created. This function only handles custom fields of the following types: single select, multi select, radio buttons and checkboxes.

|  |  |  |  |
| --- | --- | --- | --- |
| **Syntax** | admUpdateCustomFieldOptions(fieldNameOrId, options[, projectIssueTypesNames][, context]) | **Package** | adm |
| **Alias** |  | **Pkg Usage** | updateCFOptions(fieldNameOrId, options[, projectIssueTypesNames][, context]) |

## Parameters

| Parameter name | Type | Required | Description |
| --- | --- | --- | --- |
| fieldNameOrId | String | Yes | Name or id of the custom field. |
| options | JCustomFieldOption[] | Yes | Options to be updated, as a JCustomFieldOption array. The id parameter is required, value can't be empty. |
| projectIssueTypesNames | JProjectIssueTypes [] | No | An array of JProjectIssueTypes structures, representing project keys/issue types mappings. (The context in which to update the options) - to be used alternatively with  “context” parameter |
| context | String | No | The name or id of the context - to be used alternatively with the “projectIssueTypesNames” parameter |

## Return Type

**[JCustomFieldOption[]](https://appfire.atlassian.net/wiki/spaces/PSJC/pages/435028065)**

Returns an array of JCustomFieldOption structures representing the options updated to the specified custom field.

## Example

### Example

Updating an option of the checkbox custom field, using the context for project with key TP and issue types Bug and Task.

```javascript
JProjectIssueTypes[] projectIssueTypesNames;
JProjectIssueTypes map;
map.projectKey = "TP";
map.issueTypesNames = {"Task", "Bug"};
projectIssueTypesNames = arrayAddElement(projectIssueTypesNames, map);
JCustomFieldOption[] optionsToBeUpdated;
JCustomFieldOption option;
option.id = "10076";
option.value = "updated from SIL";
option.disabled = "true";
optionsToBeUpdated = arrayAddElement(optionsToBeUpdated, option);
JCustomFieldOption[] customFieldOptions = admUpdateCustomFieldOptions("checkbox", optionsToBeUpdated, projectIssueTypesNames);
int indexCC = 1;
for(JCustomFieldOption option in customFieldOptions) {
    runnerLog("---option " + indexCC + "---");    
    runnerLog("id = " + option.id);
    runnerLog("optionId = " + option.optionId);
    runnerLog("value = " + option.value);    
    runnerLog("disabled = " + option.disabled);    
    indexCC = indexCC + 1;
}
runnerLog("_________________________________________________");
```

Alternatively, the context can be used:

```javascript
JProjectIssueTypes[] projectIssueTypesNames;
string context = "TP_Context";
JCustomFieldOption[] optionsToBeUpdated;
JCustomFieldOption option;
option.id = "10076";
option.value = "updated from SIL";
option.disabled = "true";
optionsToBeUpdated = arrayAddElement(optionsToBeUpdated, option);
JCustomFieldOption[] customFieldOptions = admUpdateCustomFieldOptions("checkbox", optionsToBeUpdated, context);
int indexCC = 1;
for(JCustomFieldOption option in customFieldOptions) {
    runnerLog("---option " + indexCC + "---");    
    runnerLog("id = " + option.id);
    runnerLog("optionId = " + option.optionId);
    runnerLog("value = " + option.value);    
    runnerLog("disabled = " + option.disabled);    
    indexCC = indexCC + 1;
}
runnerLog("_________________________________________________");
```

The result will contain the updated options.

## See also

> Macro (contentbylabel)