ScriptRunner, Behaviours ; How to make a sum with an other issue

tania_bernal_ssss_gouv_qc_ca January 29, 2019

Hi, 

I have a subtask 1 and subtask 2

Each of one contains a numeric field.

 

I want to make a sum  with fieldTask1 and fieldTask2

and put my result in numeric field in the task form

 

Exemple: Task 1 = 2   (1+1)

subtask 1 = 1

subtask2 = 1

 

Thank you !!!

2 answers

1 accepted

2 votes
Answer accepted
Marc Minten _EVS_
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.
January 29, 2019

The far most easiest way is to create a (new) scripted field (you seem to have scriptrunner installed) for your Task that sums the values of the field in the subtasks. No need to use behaviours for that.

tania_bernal_ssss_gouv_qc_ca January 29, 2019

I ll try thank you .

tania_bernal_ssss_gouv_qc_ca January 29, 2019

.

tania_bernal_ssss_gouv_qc_ca January 30, 2019

thank you i solved my problem :D

0 votes
David Mayer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 29, 2019
// Get values from 2 custom fields
def valA =  getCustomFieldValue("A")
def valB = getCustomFieldValue("B")

// check both fields contain valid numeric values
if (valA != null && valB != null){
    return valA + valB
}else{
    // return to some code to indicate a null value in one of the fields
 return "-1"   
}

Suggest an answer

Log in or Sign up to answer