Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Using dynamic query on a database custom field in an issue

Example 1

The following steps will guide you on explain 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 configured

  Image Removed

The database custom field Product Name depends on the custom fields .

  1. Log into your Jira as Admin.
  2. Go to Administration > Add-ons > Database Custom Field and ensure that your dynamic sql is configured.

    Image Added

  3. The database Product Name custom field depends on the Published(customfield_

...

  1. 11900) and Not published(customfield_

...

  1. 11901) custom fields.
  2. Go to the issue and try to edit it. For this example,

...

  1. we used the same issue as

...

  1. on the

...

  1. Using autocomplete page. 
    So it looks like in the following picture on edit:

...


  1. Image Added

  2. Let's change the values for the

...

  1. Published and Not published fields,

...

  1. that we created for this example. These fields have the following ids: customfield_

...

  1. 11900(Published) and customfield_

...

  1. 11901(Not published). These are simple

...

  1. Jira custom fields, of

...

  1. the "Text Field (< 255 characters)" type.

...

  1. For the Published field, type "jjupin"

...

  1. . When

...

  1. you leave the input textbox for the Published field, the values for Product Name and Product Id fields are dynamically changed to empty values, and the available list of values for the Product Name is updated

...

  1. . This will be visible when

...

  1. you try to enter a new value by using autocomplete

...

  1. .

...


  1. Image Added

  2. In the mean time we

...

  1. type

...

  1. a value for the Not published

...

  1. field, "databasecf" for instance.
  2. Let's now use the autocomplete to see the values available for the main database custom field – Product Name

...

  1. .
    The only option left is the one displayed, which is equal with the value of the Published field.

...

  1.  On selection, the child database custom field is automatically filled in with the id of the selected product.

    Image Added

    Note

    Every database custom field has a default value: blank, displayed in a the field of

...

  1. the Select List type as "None".


  2. After

...

  1. we save the issue, the values for the custom fields are displayed in the view issue screen:

Image Removed

...


  1. Image Added

In a similar way,

...

you can use a dynamic query

...

to retrieve values for a database custom field in a select list.

Example 2

For the next example we used a configuration where the parent fields depend on each other, and when one field changes, all of the dependent fields are changed :as well.

Image RemovedImage Added


Which This means in the following screen that:

  • Product Name depends on Category and has Product Code,
  • Version depends on Product Name and has Release Date.

  Image Removed

Changing Image Added

If you change the Category field from "support" to "services", all the values are changed.

Image RemovedImage Added

Warning

Note that if the session expires, the autocomplete, or other requests will not be completed, but JIRA Jira can still update the issue if the password of the user is kept in memory.


Info
The dependent Database Custom Fields and the Database Custom Field should database custom field and its dependent database custom fields should all be on the same screen, context.

...