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
And create a Database connector, in this exercise will be a connector to the jiradb itself (then is a Local database connection).
Here an example of values:
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.
Create a new “Database Picker” with these values:
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!
Very powerful new feature of Scriptrunner for Jira Server
More info from Adaptavist here.