How to use dynamic query on a database custom field in an issue
The following steps will guide you on how to use a dynamic query to retrieve values for a database custom field, based on the values of other custom fields :
- Check in the administration page that you have a dynamic sql.
- Go to the issue and try to edit it. For this example, it is used the same issue as in the Autocomplete page. So it looks like in the following picture on edit:
- Let's change the values now, so go directly to the fields Published and Not published, special created for this example. These fields have the id: customfield_11901 (Not published) and customfield_11900 (Published). These are simple Jira custom fields, of type "Text Field (< 255 characters)".
- Let's type in first "jjupin" for Published and try to fill in the second value for Not published. At this time, the values for Product Name and Product Id are dynamically changed depending on the values of the fields Published and Not published.
- In the mean time we can type in a value for Not published as well.
- Let's now use the auto completion to see the values available for the main database custom field Product Name:
The only option left is the one displayed. This is equals with the value of Published.
- On selection, the child databse custom field is automatically filled in with the id of the selected product.
Every database custom field has a default value: blank, displayed in a the field of type Select List as "None".
- To see the results, save the issue and go to the details:
In a similar way, the dynamic query is used to retrieve values for a database custom field in a select list.
Database custom fields can be used also in other operations on issues.