Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner to display external DB value


    I am exploring a way to read from an external DB, locate a value that pertains to a name we store in the summary field.  For instance my MS SQL query and groovy would look close to this:

DatabaseUtil.withSql('fuel') { sql ->
sql.rows('SELECT [VEHICLEID] , [CURRODOM] FROM [FUELMASTER].[dbo].[VehicleCK] where [VEHICLEID] like '%{issue.summary}')

Then I would like to write the CURRODOM value to a custom field.

I can get data returned in general that looks like this (if I remove the where clause):

[[VEHICLEID:000000G1, CURRODOM:135874], [VEHICLEID:000000G2, CURRODOM:064523], [VEHICLEID:000000H9, CURRODOM:679841]......

I would like the CURRODOM number formatted to only be displayed as a number like 135874 in the custom field.


How can this be accomplished?

1 answer

1 accepted

0 votes
Answer accepted
Martin Bayer _MoroSystems_ s_r_o__
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jul 29, 2020

@jeff singler is it the complete script? I guess you need to process the results properly, something like

sql.rows('SELECT [VEHICLEID] , [CURRODOM] FROM [FUELMASTER].[dbo].[VehicleCK] where [VEHICLEID] like '%{issue.summary}').each { row -> log.error(row.CURRODOM) }

 I just pust logging function to test what value is logged. Can you try this approach?

Thank you for your help, I ended up going a completely different route to achieve this but I will need sometime in the far future to do writes to a DB with Scriptrunner so I will be back at this at some point.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events