Sum of custom field from all the linked child stories to a field in parent story

Consider below scenario -

I have field in story - "Field_1"

I have created link - Outward Description > is parent of

Inward Description > is child of

 

Now,

I want to sum up the values from all the child stories to parent story.

(We can have a scripted field configured to carry the sum of the values. Let that field be Field_2)

 

Eg- 

I have a parent story AB-123

I have three child stories linked to AB-123, let that be AB-124, AB-125, and AB126.

 

I want to sum the value of Field_1 of all the child stories to Field_2 of the parent story.

Can anyone help me out.

1 answer

1 vote

You say you have a "scripted field" for field_2. 

That means you have a scripting add-on and you should be able to create another scripted field for "read all subtasks for the data of field 2 and place it in field 1 on the parent".  It should be able to do simply issue.getSubtasks() to get the list.

Hi Nic,

I want to have those fields on story.

I do not want to use subtasks.

Thank you

Ah, sorry, you talked about "child" issues, which means "sub-task" in JIRA-speak.  I didn't realise you meant issue-links, so there's no child relationship.

You'll need issue.getOutwardIssueLink() instead of subtasks.

Can you help me with the complete expression which  I should use?

Sorry, yes, that issue.<function> is wrong.

How you get the list of links is highly dependent on where you are in JIRA, but you'll probably end up needing to use an issueLinkManager - see https://docs.atlassian.com/jira/7.3.8/com/atlassian/jira/issue/link/IssueLinkManager.html

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

121 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you