The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Take Jira ticket data and run custom script after the ticket is solved

Ioannis Benetos
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 14, 2022

Hi Community,

I have a case and I am not sure how to handle it. 

we want to run a custom script for each ticket in a one specific project. The custom script should be executed after the ticket closed. The custom script should take the data from the particular ticket and forward the information to a other tool (Datadog). The Datadog part is not the issue. How can I implement a custom script for each ticket with the triggered status of done and get the data from this ticket? 

Hope you understand my behaviour

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Fabio Racobaldo _Catworkx_
Community Champion
September 14, 2022

Hi @Ioannis Benetos ,

welcome to the Atlassian community!

If you need to execute something custom after a ticket closure, you can setup a custom post function in your close transition.

Post function is something that happens after the transition so, in my opinion, is the best way to do that. You can use ScriptRunner for JIRA (https://scriptrunner-docs.connect.adaptavist.com/jira/post-functions.html#_additional_code) to implement a scripted post function.

Another way is to setup a batch procedure that retrieve all closed tickets and perform your code for each issue.

Hope this helps,

Fabio

Ioannis Benetos
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 14, 2022

Hi @Fabio Racobaldo _Catworkx_  Thanks for the quick reply! okay and how I get the data from the ticket to use them ? I want to pick the data and forward them to a other tool

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
September 14, 2022

A post function has direct access to the issue object against which the transition is being run, so you don't have to write code to ask questions of the issue.

In other words, you can write a post-function that does things like

def email-subject = "Hey, we updated " + issue.getKey() + " " + issue.getSummary()

Like # people like this
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events