I want to determine the Story Points based on the selection of custom fields. The Custom Fields are drop-downs (text), so I need to assign a numeric value to each of the options. Then, I want to summarize the numeric values to set the Story Points total.
Here's what I have:
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.field.CustomFieldUpdatedEvent
import java.text.SimpleDateFormat
import com.atlassian.jira.datetime.DateTimeFormatterFactory
import com.atlassian.jira.datetime.DateTimeStyle
def customFieldManager = ComponentAccessor.getCustomFieldManager()
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def Story = getFieldByName("Story Points") //Grab the Story Points Field
def Impact = getFieldByName("Impact") //Grab the Impact Field
def Deliverable = getFieldByName("Deliverable") //Grab the Deliverables Field
def ImpactValue = Impact.getValue() // Grab the Value of the Impact Field
def DeliverableValue = Deliverable.getValue() // Grab the Value of the Deliverables Field
//Determine a Number based on the Impact Field Selection
if (ImpactValue.toString().contains("Low")) {
double ImpactSP = 1
}
else if (ImpactValue.toString().contains("Medium")) {
double ImpactSP = 2
}
else {
double ImpactSP = 3
}
//Determine a Number based on the Deliverables Field Selection
if (DeliverableValue.toString().contains("Document Only")) {
double DelSP = 0.5
}
else if (DeliverableValue.toString().contains("Sketch Only")) {
double DelSP = 0.5
}
else {
double DelSP = 1
}
Story.setFormValue(ImpactSP + DelSP)
I'm getting an error on the last line indicating the ImpactSP and DelSP variables are undeclared.