I'm using Script Fields in Script Runner.
For an epic I want to display any information from its tasks.
To download these tasks I use the command:
but this returns me not only issues in epic but also other issues linked to it.
How to get only issues which are connected via thic Epic by epic link ?
The approach you are trying alone will not work.
You need to perform other steps for the filtration to work correctly.
Below is a sample working code for your reference:-
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.issueLinkManager
if (issue.issueType.name == 'Epic') {
def listOfTasks = issueLinkManager.getOutwardLinks(issue.id).collect { issueLink ->
if (issueLink.destinationObject.issueType.name == 'Task') {
issueLink.destinationObject
}
}.findAll {it != null}
listOfTasks
} else {
return
}
Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot of the Scripted Field configuration:-
Below is a test output:-
If you observe the screenshot below, as configured in the Scripted Field code, it will only display all Task issue types that belong to the epic.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Great to hear the solution worked for you. :-)
Please accept the answer provided.
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ram,
Thank you very much for your answer. I used this commands:
but the solution you provided is better.
Regards,
Kate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.