Cascading Fields with Multiple Saved Value
To create related fields with Multiple Saved Value (Supports Select Multiple and Checkbox types only) in your SQL custom field plugin, follow these steps:
1. Create the main Field
Create the main field (Checkbox, Select Multiple only ) by defining its configuration and adding a query to retrieve relevant data.
For example: this configuration will create a field that displays the actor first names in Checkboxes (change your field type if you want to display data as Multiple select dropdown).
After the field creation you should copy the field id and keep it in safe place as displaying in the pictures below.
2. Save multiple values for the main Field
Navigate to the Jira view issue, then select your preferred values from the checkboxes, and click 'Save,' as illustrated in the image below.
3.Create the Related Field
After creating and saving the values of the main field, proceed to create the related field.
Define the related field query using the ID of the main field (paste the ID of the main field between '{ }' in the query of the related field)
For example: In this query ,Â
SELECT last_name FROM actor WHERE first_name IN ( '{SQL_FIELD_14}' )
last_name
is the field to be retrieved from the actor
table.
{SQL_FIELD_14}
is a placeholder for the first_name
values saved from the first field.
SQL_FIELD_14
is the ID of the main field copied in step 1, and it will be replaced with the saved values.
You can refer to the image below:Â
4.Control the related field based on the Main Field values
Navigate to the Jira view issue. You'll notice the related custom field displaying data corresponding to the values of the main custom field. Whenever you modify and save the values of the main custom field, the related custom field will automatically update to reflect the changes. You can refer to the picture below.
In this example, we will retrieve the last names of actors who have the first name 'Julia', 'THORA', or 'Angellina'.
Each time you change the values of the first names in the checkboxes, the corresponding last names will automatically update accordingly.