I am trying to add a behavior on a custom field that sums up values from several custom field and save that value to another custom field. Everything works except the addition (bolded line). It is a simple addition and I don't understand why simple addition is giving an error. I tried to force conversion to .toInteger() and it still don't work.
def cfTimeCriticality = getFieldByName("Time Criticality")?:0
def cfUserBizValue = getFieldByName("User/Biz")
def cfRROE = getFieldByName("RR/OE")
def cfCostOfDelay = getFieldByName("Cost of Delay")
def RROE = cfRROE.getValue()?:0
def UserBizValue = cfUserBizValue.getValue()?:0
def CostOfDelay = RROE + UserBizValue
cfCostOfDelay.setFormValue(CostOfDelay)
Solved the issue with the following code for the WSJF calculation. What is interesting is that script adds "48" to the value. I don't understand why this is the case but so far it worked for multiple projects and issues.
def cfTimeCriticality = getFieldByName("Time Criticality")
def cfUserBizValue = getFieldByName("User/Biz Value")
def cfRROE = getFieldByName("RR/OE")
def cfCostOfDelay = getFieldByName("Cost of Delay")
def cfJobSize = getFieldByName("Job Size")
def cfWSJF = getFieldByName("WSJF")
def RROE = (Integer)cfRROE.getValue()?:0
def UserBizValue = (Integer)cfUserBizValue.getValue()?:0
def TimeCriticality = (Integer)cfTimeCriticality.getValue()?:0
def JobSize = cfJobSize = (Integer)cfJobSize.getValue()?:0
def CostOfDelay = (RROE - 48) + (UserBizValue - 48) + (TimeCriticality - 48)
cfCostOfDelay.setFormValue(CostOfDelay)
cfWSJF.setFormValue(CostOfDelay/(JobSize - 48))
Hello @Timothy Kidd
All fields are numeric?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes
def cfTimeCriticality = getFieldByName("Time Criticality")
def cfUserBizValue = getFieldByName("User/Biz Value")
def cfRROE = getFieldByName("RR/OE")
def cfCostOfDelay = getFieldByName("Cost of Delay")
def cfWSJF = getFieldByName("WSJF")
def RROE = cfRROE.getValue()?:0
def UserBizValue = cfUserBizValue.getValue()?:0
def TimeCriticality = cfTimeCriticality.getValue()?:0
def CostOfDelay = (Integer)RROE + (Integer)UserBizValue + (Integer)TimeCriticality
cfCostOfDelay.setFormValue(CostOfDelay)
cfWSJF.setFormValue(TimeCriticality)
Finally addition doesn't give error but calculation is incorrect. 1+1+1 = 147
lol.. what obvious thing am i overlooking?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.