How can I track when issues are added to an Epic?

Joshua Wold August 6, 2014

We use Epics like one would normally use components. We use Epics in this fashion so we can use the left hand drag and drop functionality, easy sorting and ranking in the JIRA Agile planning board.

However some users are having a hard time tracking when issues are added to their given epic. Using JQL and a saved query I can track when a new issue is created within the epic at the point of issue createion. However I cannot figure out a way to track issues initially created outside the epic and then added to the epic later on.

  • 'watching' the epic issue doesn't work
  • JQL change history doesn't support the Epic-Link field

Any ideas?

Thanks in advance.

2 answers

1 accepted

0 votes
Answer accepted
AgentSmith
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 20, 2014

I don't believe its possible per se. Take a look at this https://jira.atlassian.com/browse/GHS-10570...

When issues get added to an epic, only the added issues are changed. We add a change item to the epic, but this does not trigger an issue update event for the epic. We don't plan on adding this in the near future.

You can use the epic report to see what has changed for the epic.

2 votes
Anders Lantz April 8, 2019

In case anyone runs in to this again, the scriptrunner IssueLinkCreated/IssueLinkDeleted catches these events. 

To verify that its an epic link that was updated, you can check: event.issueLink.issueLinkType.name

Eric Lakey April 11, 2019

@Anders Lantz Do you have any example scripts you can share that use those events.  i can only find bits and pieces and can't get them to work, so I'm hoping I'm missing something simple. 

Anders Lantz April 12, 2019

I use ScriptRunner event listner, and set it to listen for link deleted and created, then I use the following code to determine if its an epic link.

 

if ([IssueLinkDeletedEvent, IssueLinkCreatedEvent].contains(event.getClass())) {

log.debug("Issue link event")

if (event.issueLink.issueLinkType.name == "Epic-Story Link") {
log.debug("Epic link event")
log.trace("Destination Issue:" + event.issueLink.destinationObject)
log.trace("Source Issue:" + event.issueLink.sourceObject)
log.trace("Link Type:" + event.issueLink.issueLinkType.name)
if (event instanceof IssueLinkDeletedEvent) {
log.debug("Link deleted")
} else if (event instanceof IssueLinkCreatedEvent) {
log.debug("Link created")
}


}else {
log.debug("Link type:" + event.issueLink.issueLinkType.name)
log.debug("\tNot Epic link event, not related")
return
}
Eric Lakey April 18, 2019

@Anders Lantz Thanks so much.  I'm rather new to scriptrunner and groovy scripting.  what import statements do i need to have for that code snippet to work?  If I paste it in as is, I got this error: "unable to resolve class IssueLinkDeletedEvent"  I've added in these import statements: 

import com.atlassian.jira.event.issue.link.IssueLinkCreatedEvent
import com.atlassian.jira.event.issue.link.IssueLinkDeletedEvent

But now I'm getting "No such property: issueLink for class: com.atlassian.jira.event.issue.IssueEvent."  How do I resolve that?

Like SWAPNIL SRIVASTAV likes this
Anders Lantz April 26, 2019

Hi @Eric Lakey !

Your imports looks correct to me, my guess is that the event you are looking at simply isn't an issue link event, thus doesn't have the issueLink property.  You can configure your SR listener to only trigger on IssueLinkCreatedEvent, IssueLinkDeletedEvent

I check if it's an issue link event in the first if-statement, you could do the same. 

 

To get more information about what properties the event has you can do:

log.trace("Event:" + event.getClass())
event.properties.each { log.trace("\t" + it) } 
Anders Lantz April 26, 2019

I just realised this question was tagged with jira cloud but my code is for Jira Server, so it won't likely work on cloud without modification. 

Eric Lakey April 26, 2019

I didn't realize this was a jira cloud conversation either.  I'm on server, so your script should work for me.  I'll keep plugging away trying to figure this out.  Thanks for your help!

SWAPNIL SRIVASTAV August 7, 2019

Hi @Eric Lakey  and @Anders Lantz ,

I have facing the same issue and getting the same error "No such property: issueLink for class: com.atlassian.jira.event.issue.IssueEvent." @Eri Are , Could you please tell me how did you manage to resolve the same. 

Suggest an answer

Log in or Sign up to answer