I am looking for Script to add in behavior field with detailed step which fulfils my requirements
My requirement is whenever we change the priority in jira it displays normally Priority changed from Major to Minor but it does not display the same message in service portal which customer refer. Customer is always blind in service portal when the priority is changed
Hence i am looking or a script whenever we change the priority from Major to minor in Jira the comment to be automatically added in Service portal which is visible to customer "The priority for this issue has changed from Major to Minor"
I am aware it works with "Automation for Jira - Server" but i dont have this application and looking for only script runner
Thanks and Regards,
Sharad
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
}
}
getFieldById(getFieldChanged())
gets the ID of the field the script is attached to. So the behaviour would be linked to the Priority field in your case.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.