Hi - I am trying to write a script that gets values from custom fields, does a calculation on the value and then stores the calculation in a custom field. Also shows a message of what the new value is based on the calculation.
Here is what I have so far:
def bvField = getFieldById("customfield_11212")
def tcField = getFieldById("customfield_11214")
def rrField = getFieldById("customfield_11213")
def jobSizeField = getFieldById("customfield_11224")
def wsjfField = getFieldById("customfield_17616")
def editScreen = getFieldById("customfield_15321")
def createScreen = getFieldById("customfield_15320")
def bvValue = bvField.getValue()
def tcValue = tcField.getValue()
def rrValue = rrField.getValue()
def jobSizeValue = jobSizeField.getValue()
def wsjfValue = wsjfField.getValue()
def wsjfCalc = bvValue + tcValue + rrValue / jobSizeValue
if (createScreen && editScreen){
if (bvValue != 0 && tcValue != 0 && rrValue != 0 && jobSizeValue != 0){
return wsjfCalc
} else {
return "You must populate all number fields to calculate WSJF"
}
}