JQL query for the jira database values plugin

I have just finished implementing a custom JQL query for the jira database values plugin. It allows to search on anything you want related to the value you have in your custom field.

Take the example of a “Customer” custom field that links to a customer table in a database. Previously it was not possible to search for all issues linked to the customers from a certain country for example. With the new JQL query, it is as easy as:

Customer IN dbValue("Country", "Belgium")

How can this work?

All you need to do is add this to your properties file:
jql.1.query.reference=Country
jql.1.query=select id from customer where country = 'QUERY_VALUE'

The first line defines what should be the first argument used in the JQL query. If the plugin finds this matching query reference, then it will execute the matching query, replacing QUERY_VALUE with the 2nd argument passed into the JQL query. So the actual query against the database in our example becomes:

select id from customer where country = 'Belgium'

Important point: the query should only return 1 column and it has to be the column you have also defined as primary key column.

This will be coming in the 1.2 release of the plugin. If you want to try it out, take the build from https://studio.plugins.atlassian.com/builds/browse/JDVP-TRUNK-44/artifact. Let me know if it works for you (or not!) or you might need something extra.

Advertisements

2 thoughts on “JQL query for the jira database values plugin

  1. Hi, I’m developing a Jira plugin which requires a own table in the database. But with Jira 4.3.4 and Crowd. The connection which i open in the source will be blocked.
    Do you have any ideas how to do that?

    CheerzZ
    CodeGorilla

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s