Example 4 - Dependent custom fields

For this example, we have two custom fields: one representing continents and another representing countries: PCF - Single Autocomplete and PCF - Multiple Autocomplete. The second field populates based on the value of the first field.

The first custom field has five options representing the five continents, and the second one contains the countries from the countries table, depending on the value selected in the Continent one. 

To use the screen values for a field in the data source, add it as a dependent field

image-20240214-170838.png

The following data source represents the first custom field: 

return {"AFRICA", "ASIA", "EUROPE", "AMERICA", "OCEANIA"};


The following data source represents the second custom field: 

string x = argv["customfield_10101"]; string[] res = sql("myDB", "select country from countries where continent like '" + x + "'"); return res;


The following result displays in the issue view screen: 

See More