How to Add Custom Options into Field Options Sync [Dictionary]
Using the Field Options Sync
use case with the Dictionary
type, you can synchronize an external list with a native Jira custom field. This works well so far if you want the custom field to be exactly as the data source provides the data. In some cases, you may want to add additional field options, but they are not present in the data source. So far, any manually added field options are disabled after each synchronisation if they are not present in the data source. But there is a workaround…
Sample Data Source
Let’s say you are using the File Options Sync
with a data source named original
that returns the following data:
{
"result": [
{
"Id": "001",
"Name": "Name1"
},
{
"Id": "002",
"Name": "Name2"
}
]
}
This will result in a custom field select-list that has 2 options: Name1
and Name2
Additional Field Options
To add custom values to this data source let’s create a custom JSON file on your local computer and name it extension.json
{
"result": [
{
"Id": "Custom001",
"Name": "Manual1"
},
{
"Id": "Custom002",
"Name": "Manual2"
}
]
}
It should be structured like the original data source and the ID
fields should not collide with any ID
from the original data source.
Create a new data source of type File
and upload the previously created extension.json
and name the data source extension
for example.
Merge data sources
Now create a third data source with a name like merged data
of type Merge Data Sources
and select the extension
and original
data sources from the drop down.
Testing the merge will now return data looking like this:
{
"result": [
{
"Id": "Custom001",
"Name": "Manual1"
},
{
"Id": "Custom002",
"Name": "Manual2"
},
{
"Id": "001",
"Name": "Name1"
},
{
"Id": "002",
"Name": "Name2"
}
]
}
Now you only have to change the data source in the Field Options Sync
from original
to merged data
and now your custom field options will be synced automatically.