You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello,
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?
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.