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.
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
This note looks out of date and can be deleted if most users are using a version of PCF after 5.8.0.x. This would be a lot of users if the current version is 6.2.820.x.