I want to be able to link sub-tasks to an epic.

Ana Teixeira March 9, 2017

Epic link to Subtasks.jpgThis question is in reference to Atlassian Documentation: Managing your projects

Jira's current settings doesn't allow sub-tasks to be linked to an epic. This causes my numbers in the dashboard (Workload pie chart) to be incorrect when summing up hours by epic. Very inconvenient!

Is there a way to change the settings or even develop a script/ plugin to be able to select a epic link to sub-tasks?

I need this ASAP, the success of my project management depends on it.

 

Thank you,

 

Ana Teixeira

2 answers

8 votes
Ana Teixeira March 10, 2017

Thank you, Nic!

It's good to know it's possible to do it at all. Now maybe someone will be able to confirm if it's possible on the cloud.

2 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 9, 2017

There's two parts to this

  1.  It's absolutely correct that a sub-task should not be assigned to an Epic.  A sub-task belongs to a parent, and hence belong to an Epic via that
  2. It's absolutely a howling bug or flaw in JIRA that sub-tasks do not behave as though they belong to the same Epic as their parent

Yes, a few times I've scripted a field that echoes the actual epic on parent, epic and sub-task.  It works.  I am not sure you can do it on Cloud though.

Deleted user January 9, 2018

Hi @Nic Brough -Adaptavist-,

could you post the scripted field that shows the epic link from the subtask here?

Regards and thank you

Ricardo da Silva

Deleted user January 10, 2018

Got it.

i used a scirpted field with an custom template:

#set ($issueLinkManager = $jirautils.loadComponent('com.atlassian.jira.issue.link.DefaultIssueLinkManager', $issue.getClass()))
#set ($parent = $issue.getParentId())
#foreach ($link in $issueLinkManager.getInwardLinks($parent))
#set($links = $link.getSourceObject().getSummary())
<a class="aui-label ghx-label-7" title="Follow link" href="/browse/$value"> $links </a>
#end
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLink

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def parent = issue.getParentId()

for (IssueLink link in issueLinkManager.getInwardLinks(parent)) {

return link.getSourceObject()

}
Schuyler Bishop February 28, 2018

Hey Ricardo,

 

I set up a custom field using this script and it worked like a charm. Thanks! 

I have a follow-up question for you: I have an epic, a task linked to the epic, and a sub-task that inherited the epic key using your custom field. How do I filter for the sub-task in the issue navigator? I don't think this scripted field is JQL friendly. 

 

Thanks,

Schuyler Bishop

Deleted user April 13, 2018

Hi Schuyler,

yes thats right but you can set your filter like
"Epic-link Sub-task" ~ "your Epic Name"
Than it should works

Regards

Ricardo

Schuyler Bishop April 13, 2018

Success. Thanks, Ricardo! 

Mike Glavatskykh
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 25, 2019

Hey Ricardo, Schuyler!

This seems to be a solution for me as well. 

I'm a bit new in Jira admin, can you describe a bit more how you create this scripted field?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 26, 2019

I think they installed ScriptRunner then created a scripted field with the code given above.

Andrea Montali November 28, 2020

This seems to be for Jira Server.
How can I use it for jira cloud?
thanks Andrea

Jar Lady April 2, 2024

How come are there 2 scripts for this? How to incorporate that into script runner?

Suggest an answer

Log in or Sign up to answer