Forums

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

Summation of three numerical fields from Subtask to 1 new field in User Story

Frederique FOREY
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!
November 12, 2018

Hello,

I have a numeric Field customised in User Story : Sum _Time -Sub-Task,

 this US has N Sub-task.

Every  Sub-task  has a Numeric Field : Time-Sub-Task

I want to calculate automatically the sum of Time-Sub-Task of the N Sub-Task in Sum_Time -Sub-Task  ?

How can I do this ?

Thank You

(Sorry for my awful english, thank you)

 

2 answers

0 votes
Sreenivasaraju P
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.
November 12, 2018

You can use Jira Misc Custom Fields plugin and calculate the sub task field value on parent ticket 

 

https://marketplace.atlassian.com/apps/27136/jira-misc-custom-fields?hosting=server&tab=overview

 

for (Issue subtask : issueObject.getSubTaskObjects()) {
CustomField number=customFieldManager.getCustomFieldObject("customfield_XXXX");
Double numbervalue=(Double)subtask.getCustomFieldValue(amountField);
Sum = sum + numbervalue;

}
0 votes
Alexey Matveev
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.
November 12, 2018

Hello,

You would need an add-on for it.

For example, you could use the Power Custom Fields Premium add-on:

https://marketplace.atlassian.com/apps/1210749/power-custom-fields-premium?hosting=server&tab=overview

You could create a sil custom field with a code like this and add this field to the view screen of the Task issue type:

number sum = 0;
string[] keys = subtasks(key);
for(string key in keys){
#{number field name} = #{number field name} + %key%.#{number field name};
}

This custom field would show the sum of the Number Field custom field for all subtasks of the task.

Suggest an answer

Log in or Sign up to answer