Forums

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

JQL to pull custom field value for linked issues

Matt Fetting
June 9, 2021

I am starting with a JQL query of:

Label = Cool_Label_Name

This returns my interesting issues, and I can enable the column "Links" to see the Linked issues. Great. Now I'd like to be able to also return the value for one particular custom field (call it "XYZ Item Number") for any Linked items. Right now, with the query as-is, that custom field is empty because it's not trying to pull that from the linked issue, it's pulling it from the results of "Label = Cool_Label_Name"

Hoping to be able to do this, or something very close it, without a plugin!

 

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
Contributor
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
TAGS
AUG Leaders

Atlassian Community Events