Forums

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

When num is added to the subtasks--then display sum in parent story

kiran February 15, 2023

Hi Team,

Can someone help me with the automation for when value is added to the subtasks ie number of custom fields that should display on the parent with sum of those values including the value in the story.

Ex- If subtask1--5
         subtask2--5
         subtask3--5

But Story has the value of 10 now after the automation--story should display- 25 not 15 

Looking forward for the response

1 answer

0 votes
Tobias H
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

Hi Kiran!

Do you have an automation that looks like this?storypoint.subtasksum.png

 

If you do: The code in the box on the right side only adds sum of Subtask story points and join them together and write that into the Story point field of the parent issue.

(It does not add the value of the subtasks to the original value of the parent)

kiran February 15, 2023

Auto.PNG

kiran February 15, 2023

Hi Tobias H,

Thank you for your quick reply,

I have attached the screenshot of the rule. I have Num custom field in both subtasks and story. If story has value 10 including subtasks values ie Ex- If subtask1--5
         subtask2--5
         subtask3--5

After the rule story should display 25 not just 15 in the story. on the same custom field. Any help would be appreciated.

 

Regards,

Kiran

kiran February 15, 2023
Tobias H
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

If you could provide the actual code used to do this, I might be able to assist. Your automation looks correct otherwise :)

As I said, it might be that you are using a code (like the one I posted above) that sums together the three subtask values and then just overwrites the parent value.

Value1(5) + Value2 (5) + Value3 (5) = ValueTotal (15)

ValueTotal is then edited into the Story Point field on the parent, so it EDITs ParentValue and CHANGES it to ValueTotal. It doesn't care for the previous value of the Parent field.

(Instead of ParentValue (10) + ValueTotal (15) = NewTotal (25))

kiran February 15, 2023

Hi @Tobias H ,

This the code being used 

But i see error in the log

auto 1.PNGCode.PNG

Tobias H
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

{
"fields": {
"Num": {{#=}}{{subtasks.Num.join(" + ")}}{{/}}
}
}

Could you try this code instead (basically just swapping the second #= to a /)

It will still just add the subtask Num values and overwrite whatever is in the Num value of the parent, but it shouldn't generate an error.

I am not a programmer, but I'll try to help you figure out how to get the value of Parent.Num + subtask.Num = Total.Num

(Not sure if it can be done, but we'll see :D)

kiran February 15, 2023

Hi @Tobias H ,

Thank you for your response,

Its working now without any errors. But only subtasks value is getting added not with story.

Story already has an value --5 

        subtask1--10
         subtask2--10
         subtask3--10

Total showing now after the automation is 30 but it should be 35 including the value of the story. 

kiran February 15, 2023

It should not override the story it needs to add the value including story and display on the story itself. 

Tobias H
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

Hi again!

I totally understand the problem, but I do not have a solution (if there is one) right now. Happy to hear that it runs without errors for now :)

As said previously, I'll try to look for a solution that would make sure that the total adds up to 35, and not just 30, but I am not sure what needs to be configured to do so off the top of my head.

kiran February 15, 2023

Hi,

Thank you for your help. 

We will see if anyone can solve this. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2023

Hi @kiran 

To confirm what @Tobias H suggests...to do what you ask you will need two fields: the original value in the parent and the current total (i.e., "original" + sum of child values).

If you have two fields, this is possible.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events