Forums

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

How to fire a event only a particular transition in script listeners

Vineela Durbha
Contributor
February 12, 2019

Hi ,

I have a custom listener while is doing some action. But I want to this to run only on a particular transition of a status.

Is there any way I can define as such. I am using All Issue events now which is not working

2 answers

1 vote
Tarun Sapra
Community Champion
February 13, 2019

Hello @Vineela Durbha

Just to add to the answers already provided, if you add a new custom event and fire that event in the post-function of your transition. Then you might have a hard time trying to find the new event in the list of events in the Script runner's listener section

Please see the open issues

https://community.atlassian.com/t5/Marketplace-Apps-questions/Custom-event-missing-from-Events/qaq-p/701208

https://community.atlassian.com/t5/Adaptavist-questions/Custom-Event-not-showing-up-in-Script-Runner-Listener/qaq-p/914453

Sometimes the instance needs to be restarted and re-indexed for the new event to be available in the event list in the custom listener. 

0 votes
Sid
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 Leaders.
February 12, 2019

Firing a custom event from a listener is already a built in feature.

you can try 

https://confluence.atlassian.com/adminjiraserver071/adding-a-custom-event-802592793.html#Addingacustomevent-addcustomeventAddingacustomevent 

Go the Script Listeners page {baseurl}/plugins/servlet/scriptrunner/admin/listeners and click "Fire an event when condition is true." 

Screen Shot 2017-08-24 at 12.43.56 PM.png

Vineela Durbha
Contributor
February 13, 2019

HI @Sid

I have already a Generic event to be fired.

My problem is that my listener is being called on any transition for a status. So I wanted to restrict it

Alejandro Suárez García
Atlassian Partner
February 13, 2019

Hi @Vineela Durbha, you can create a new Event in the administration event page, add it to the transition you want instead of "Generic event", and in your listener, search for that event and add it.

That should do the work.

Regards.

Vineela Durbha
Contributor
February 13, 2019

Hi @Alejandro Suárez García

May be I confused you guys with my question.

Actually I am trying to run this only for a transition name.

Lets  say I have a status called "Created" and  I have "Update","Reject"  transitions on that status, I wanted to run it only for Update not for Reject.

I have added "All Issue Events" under my listener

Alejandro Suárez García
Atlassian Partner
February 13, 2019

Hi @Vineela Durbha, yes i understood your question, and a solution for it is what I posted before. 

Regards

Suggest an answer

Log in or Sign up to answer