Hi,
Can someone please help me with script.
I m looking for beviour script, if i change field value of Priority to Blocker the Comment to be added in Jira .
The comment should be Prioity is changed fro OLD value to NEW value
You can identify when a field changes using getFieldChanged() method
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
def customFieldManager = ComponentAccessor.getCustomFieldManager()
@BaseScript FieldBehaviours fieldBehaviours
// import org.apache.log4j.Level
// import org.apache.log4j.Logger
// def log = Logger.getLogger("com.acme.CreateSubtask")
// log.setLevel(Level.DEBUG)
def fieldChanged = getFieldById(getFieldChanged())
if(fieldChanged.getFieldId().compareTo( "customfield_12300") == 0)
{
def sites = getFieldById("customfield_10200")
// log.debug("****~" + fieldChanged)
// log.debug ("Field changed : $fieldChanged and it's value is ${fieldChanged.value} - ${fieldChanged.rawValue}")
if (fieldChanged.getValue() == "Y") {
sites.setFormValue("")
fieldChanged.setFormValue("")
} else {
// no action
}
}
log.debug ("Field changed : $fieldChanged and it's value is ${fieldChanged.value} - ${fieldChanged.rawValue}")
should show current and previous values.
That can be used to create a comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.