Forums

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

Scriptrunner listener trigger on "issue updated" does not work when story attached to epic

Antoine _Klee Group_
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.
December 8, 2022

Hey,

I want to trigger a listener each time an epic is updated, specifically when a story is added to the epic via the "epic link" field.

(The end goal is to fill a "bigger sprint" field based on the stories' biggest sprint within the epic).

Seems like setting the epic link of a story does update the "updated date" of the parent epic but for some reason, this does not trigger the listener.

Any way to work around that? Am I doing something wrong?

For know the workaround I do is to basically empty the field on a scheduled basis, which of course completely clutters the issue history.

Thanks.

 

image.pngimage.pngimage.pngimage.png

1 answer

2 votes
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 Leaders.
December 8, 2022

This is an annoying one, but something that makes sense if you look at it from the point of view of the people who are given a story to implement in Jira, without fully understanding the wider picture.

Listeners work off events, and "issue updated" events are only fired by changes to issues.  When they are, the event contains a pointer to the issue that has been changed.  

Now, in this case, when you are updating links, you are only changing the child issue - the Epic link only exists on the child.  Despite the fact that the Epic effectively gets updated as well, there's not technically any change to the Epic, so no event is fired. 

The change of updated date on Epics when they gained or lost stories was a "nice to have" feature that Atlassian implemented ages ago (there was a time when adding issues to an Epic appeared to have no effect on the Epic at all), but it was done in a minimal way, without looking at the actual problem it should have been solving - i.e. exactly what you've got here!

What you should do is create a listener that listens for the child issues having an Epic link set, and read that as the trigger for the rest of your script.

Alex Koxaras _Relational_
Community Champion
December 13, 2022

Great explanation Nic! Thanx for that info! 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events