Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

admAddCustomFieldOption(fieldName, options[, projectIssueTypesNames])

Package

adm

Alias

Pkg Usage

addCFOption(fieldName, options[, projectIssueTypesNames])

Description

Excerpt
hiddentrue
Adds new custom field options to options list for the specified context (JProjectIssueTypes[]).

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

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

fieldName

String

Yes

Name of custom field.

options

JCustomFieldOption[]

Yes

Options to be added, as a JCustomFieldOption array. The id parameter is not needed and will be ignored, value can't be empty.

projectIssueTypesNames

JProjectIssueTypes []

No

An array of JProjectIssueTypes structures, representing project keys/issue types mappings. (The contexts where to add the options)

Return Type

JCustomFieldOption[]

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

Example

Example

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

Code Block
languagejs
JProjectIssueTypes[] projectIssueTypesNames;
JProjectIssueTypes map;
map.projectKey = "TP";
map.issueTypesNames = {"Task", "Bug"};
projectIssueTypesNames = arrayAddElement(projectIssueTypesNames, map);
JCustomFieldOption[] optionsToBeAdded;
JCustomFieldOption option;
option.value = "added from SIL";
optionsToBeAdded = arrayAddElement(optionsToBeAdded, option);
JCustomFieldOption[] customFieldOptions = admAddCustomFieldOptions("checkbox", optionsToBeAdded, 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("_________________________________________________");

The result will contain the options added, now with ID's.

See also

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "customfield_admin_routine" and space = currentSpace ( )
labelsarray_routines