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
Hi @Sharadkumar Bangera
You can identify when a field changes using getFieldChanged() method
import com.atlassian.jira.component.ComponentAccessorimport com.onresolve.jira.groovy.user.FieldBehavioursimport groovy.transform.BaseScriptdef 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.
It looks like you're new here. Sign in or register to get started.