I’m working on a Jira project and need to create a dropdown menu that pulls its options from our SQL Server database. When users create or edit tickets, they should see a select field with values that come directly from the database rather than hardcoded options.
Our setup is Jira standalone and we’re using Groovy for scripting. I’ve been looking through documentation but I’m having trouble finding clear examples of how to connect to SQL Server and populate dropdown fields dynamically.
Can someone point me in the right direction? I’m relatively new to Jira customization so any step-by-step guidance would be really helpful. What’s the best approach to establish the database connection and refresh the dropdown options?
I’ve done this exact setup with ScriptRunner’s REST endpoints. Skip the scripted field that hits the database constantly - build a custom REST endpoint that queries SQL Server and returns JSON instead. Then use a behavior script to populate the select list with AJAX calls. Way better control over database queries. You can cache results or trigger refreshes based on specific conditions. For SQL Server connection: drop the JDBC driver JAR in the lib directory and restart Jira. Your Groovy script needs proper connection pooling or you’ll exhaust database connections with concurrent requests. Watch out for transaction timeouts on slow queries - I got burned by this. Add a timeout parameter to your connection string and optimize your SQL queries first.
You could also try the Database Values custom field if you don’t want to deal with ScriptRunner. It’s a commercial addon but works great with SQL Server. Just set up your JDBC connection in the plugin settings and write your select query. The dropdown populates automatically and you can set refresh intervals. I’ve been using it for 2 years without any problems.
To connect Jira to SQL Server for populating a dropdown, you’ll want to use a plugin like ScriptRunner. This allows you to create a scripted field. Start by installing the SQL Server JDBC driver in Jira. In your script, set up the connection to your database, execute your query, and ensure that the results populate the dropdown options. Keep an eye on performance, as database calls can slow things down. Implement caching to mitigate this and consider handling database connection issues gracefully to avoid disruptions in ticket creation.