Dependent select lists - XML datasource
Configure the datasource
The first step is to configure the data source, this is easily done, just follow our documentation and adapt it to your own configuration. You can either set a local XML file or a URL data source that return XML format, the field configuration is equivalent in both cases.
Let us say our data are organised in different tables :
Create the Connect fields
Creating the Elements Connect fields is pretty straightforward and is described here in our documentation.
We require 3 fields:
Connect Live Text: Continent
Connect Live Text: Country
Connect Live Text: City
Configure the Continent selection field
The first select list is simple, it is supposed to fetch all the Continent names that are stored in the continent table. We are going to use the id attribute as the key, so that this value will be used to configure the next select lists.
Configure of the Edit view, from the "Edit" tab:
Xpath
/data/continents/*
Columns:
id,continent_name
Key
0
This number refers to the column number in the result set (numbering starts at 0).
This is the value stored in the customfieldvalue table in the Jira Database. It's use to retrieve the selected value when the field is edited.
You can find more information about how to configure the edit view here.
Editor
Select list
Selection
The user can select only one value
Columns
1
Template
{1}
Configure the Country selection field
The values that are displayed in the Country field needs to be different depending on what value is selected in the Continent field. The Country table contains an attribute that will be useful to determine whether the value must be displayed. The continent_id attribute contains the id of the corresponding continent. That attribute must match the continent that has been selected.
Configure of the Edit view, from the "Edit" tab:
Xpath
/data/countries/*[@continent_id='$issue.get("Continent")']
Note here the Edit query depends on the Continent value that has been previously selected. This dependency also appears in the Configure field section of the Elements Connect administration page under the Dependencies column.
Columns
id,country_name
Key
0
This number refers to the column number in the result set (numbering starts at 0).
This is the value stored in the customfieldvalue table in the Jira Database. It's use to retrieve the selected value when the field is edited.
You can find more information about how to configure the edit view here.
Editor
Select list
Selection
The user can select only one value
Columns
1
Template
{1}
Configure the City field
Almost done, finally the City field. The configuration here is very similar to the previous one, except that here we are going to match the country_id attribute with the value that has been selected in the Country field.
Xpath
/data/cities/*[@country_id='$issue.get("Country")']
Columns
id,country_name
Key
0
Editor
Select list
Selection
The user can select only one value
Columns
1
Template
{1}