Hi,
In our journey towards the implementation of SAFe in our organization, I want to implement some SAFe parameters in our JIRA environment. One of these is the Weighted Shortest Job First (WSJF). A scripted field (using the Script Runner plug-in) is used to calculate the WSJF value based on a simple formula (four numeric values entered in four custom fields).
I have no Java or Groovy experience, so the code I came up with is just based on examples I found elsewhere:
The code below works fine (WSJF value is as it should be), but I get an 'error' (see screenshot) on the line with the actual formula (last if-statement). I don't want to implement the field with this error, so any suggestion is appreciated. Thx
import com.atlassian.jira.component.ComponentAccessor
def BUS_VAL_FIELD = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Business_Value")
def BUS_VAL= issue.getCustomFieldValue(BUS_VAL_FIELD)
def TIME_CRIT_FIELD = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Time_Criticality")
def TIME_CRIT= issue.getCustomFieldValue(TIME_CRIT_FIELD)
def RISK_REDUC_FIELD = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Risk_Reduction")
def RISK_REDUC= issue.getCustomFieldValue(RISK_REDUC_FIELD)
def JOB_DUR_FIELD = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Job_Duration")
def JOB_DUR= issue.getCustomFieldValue(JOB_DUR_FIELD)
if (BUS_VAL) {
if(TIME_CRIT) {
if(RISK_REDUC) {
if(JOB_DUR) {return (BUS_VAL + TIME_CRIT + RISK_REDUC)/JOB_DUR}
else {return null}
}
else {return null}
}
else {return null}
}
else {return null}
