Hi TEam,
I have the code below to set the field "Severity Update Flag" when there are changes to the field "PSIT Severity" , how ever behavior below fires even when there is no change to the field PSIT Severity just when we click the edit button is there a way to avoid it?
Please let me know
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issue = underlyingIssue
def tgtField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "PSIT Severity"}
// Get a pointer to both my fields
def demoSelect = getFieldByName("PSIT Severity")
def demoMultiTxt = getFieldByName("Severity Update Flag")
// Get the Value of the Select List Field
def selectedVal = demoSelect?.getValue()
def previousVal = tgtField?.getValue(issue)
if (selectedVal != null){
if (selectedVal?.toString()?.equalsIgnoreCase(previousVal?.toString())) {
log.debug("Values are the same I will set the Val to False")
String val ="False"
demoMultiTxt?.setFormValue(val)
} else {
log.debug("Values are different I will set the Val to True")
String val ="True"
demoMultiTxt?.setFormValue(val)
}
}