Multilevel Select Picker Configuration
Get Field Id
Using URL
Please note, the Administer Jira Global permission is necessary to complete these steps.
Navigate to Settings () > Issues > Custom fields under the Fields section
Click on the More (⋯) icon to the right of the custom field you are obtaining the ID
Select the View field information option
Observe the URL in your browser, which will contain the ID of the field:
In the above example, the custom field ID is 10026.
Using API
Using the Get Fields Jira Cloud API endpoint, custom fields can be returned in a list. Please see the Cloud REST API documentation. The returned JSON data will need to be filtered to identify the field you are looking for and its ID.
Sample response from the API:
{
id: 'customfield_10026',
key: 'multilevel-picker-field-type__customfield_10026',
name: 'your-field-name',
untranslatedName: 'your-field-name',
custom: true,
orderable: true,
navigable: true,
searchable: true,
clauseNames: [ 'cf[10026]', 'your-field-name' ],
schema: {
type: 'object',
custom: 'ari:cloud:ecosystem::extension/.../multilevel-picker-field-type',
customId: 10026,
configuration: [Object]
}
}
Get field configuration context Id
Using API
Get the configuration contextId
of a custom field over Cloud REST API documentation. Returns a paginated list of configurations for a custom field. Because every custom field type can hold different configurations, contextId
is needed if you want to update specific one.
The result can be filtered by one of these criteria:
id
fieldContextId
issueId
projectKeyOrId
andissueTypeId
Otherwise, all configurations are returned.
Create/Update field configuration (options)
Using API
Update the configuration for contexts of a custom field over Cloud REST API documentation. This API require path parameter fieldIdOrKey
obtained from above API (The ID or key of the custom field, for example customfield_10026
).
Body parameter configurations
, also required, contain the list of custom field configuration details. If you want to update existing context configuration contextId
must be provided, otherwise unique id can be passed to create new one.
Here is the explanation of the structure. Each item in the tree is an object that has a title, key (unique id) and children elements. We use new Date().getTime()
to create a timestamp as a key in order to automate the process. Two timestamps can never be the same, since they are calculated in milliseconds. It looks like this:
{ title: "", key: new Date().getTime(), children: [] }
If you want to insert the icon for adding new items, you should add the following line:
{ key: new Date().getTime() + 1, icon: true, parentKey: "<Unique Parent Key>" }
Notice the parentKey property. It contains the key of the parent item, meaning you will be able to add children element under the specified parent item.
The “Add” icon should always come after the last element in the list. So the whole parent item looks like this:
{ title: "", key: new Date().getTime(), children: [] }, { key: new Date().getTime() + 1, icon: true, parentKey: "<Unique Parent Key>" }
When adding a child item, it should be defined in an array of the parent item like this:
{ title: "", key: new Date().getTime(), children: [{ title: "", key: new Date().getTime(), children: [] }], } },
The isMultiple property specifies, if the select picker is single or multiple. For single define false and for multiple define true.
In order to make this request successful, body should follow this scheme and it’s property names:
`{
configurations: [
{
configuration: {
options: {
tree: [
{ title: "", key: new Date().getTime(), children: [{ title: "", key: new Date().getTime(), children: [] }] },
...
{ title: "", key: new Date().getTime(), children: [], }, { key: new Date().getTime() + 1, icon: true, parentKey: "<Unique Parent Key>" }
]
},
isMultiple: false
},
contextId: "<Unique Id>"
}
]
}`
Example of body parameter:
`{
configurations: [
{
configuration: {
options: {
tree: [
{ title: "Option 1", key: new Date().getTime(), children: [{ title: "Option 1.1", key: new Date().getTime(), children: [] }] },
...
{ title: "Option 2", key: new Date().getTime(), children: [], }, { key: new Date().getTime() + 1, icon: true, parentKey: "<Unique Parent Key>" }
]
},
isMultiple: false
},
contextId: "<Unique Id>"
}
]
}`