In this exercise, we want to show a custom field with database values in our Jira Server with Scriptrunner installed.

First of all, we need to go to “Resources” section

Captura de pantalla 2019-11-01 a las 14.12.38

And create a Database connector, in this exercise will be a connector to the jiradb itself (then is a Local database connection).

Captura de pantalla 2019-11-01 a las 14.13.41

Here an example of values:

Captura de pantalla 2019-11-01 a las 14.15.14

SQL (it’s an example to list projects):


SELECT p.pkey, count(*)
from jiraissue j
inner join project p on p.id = j.project
group by p.pkey

Now we are ready to create the new Script Field, then , go to the Script Field section.

Captura de pantalla 2019-11-01 a las 14.16.45

Create a new “Database Picker” with these values:

Captura de pantalla 2019-11-01 a las 14.21.19

Captura de pantalla 2019-11-01 a las 14.18.42

SQL:


select id, pname from project
where lower(pname) like concat(lower(?), '%')

Now you can Preview and Save! To finish remember to show the field in some Screen!

Captura de pantalla 2019-11-01 a las 14.18.53

Very powerful new feature of Scriptrunner for Jira Server

More info from Adaptavist here.

By MrAddon

Posted by:.

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 )

Facebook photo

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

Connecting to %s