Forums

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

Jira: how can have a numeric field instead a text field in my addition on behaviour script ?

Aurélie Geoffroy October 19, 2018

// field cnTest script

 

// (initialisation) (3 field numeric in my form)


def totalField = getFieldByName("CnTest")
def fieldA = getFieldByName("Cn1")
def fieldB = getFieldByName("Cn2")

 

// here i get the value of my form field

def total = totalField.getValue()
def totalA = fieldA.getValue()
def totalB = fieldB.getValue()

 

mistake

total = totalA + totalB

but work with : total= fieldA.getValue().toString() + fieldB.getValue().toString() i dont want 59 but 5 + 9 = 14

 

// add to a form

totalField.setFormValue(total)

 


///////////
in my form
cn1 = 5
cn2 = 9

i try something but my answer is 59
i think getvalue give me a text field but i specify in my jira numeric
im confused

 

 

 

thank you if you can help me

1 answer

1 accepted

0 votes
Answer accepted
Aurélie Geoffroy October 19, 2018

Find and work

 

// déclaration des champs
def totalField = getFieldByName("CnTest")
def fieldA = getFieldByName("Cn1")
def fieldB = getFieldByName("Cn2")

// obtenir les valeurs


//int total = totalField.getValue() as Integer
int totalA = fieldA.getValue()as Integer
int totalB = fieldB.getValue() as Integer

totalField.setFormValue(totalA + totalB)
//return total

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events