I'm trying to make the removal of a certain label fire off an event to have an email being sent to a few people on the team, is there a way to do this?
Hi @Liam Page _EXT_ ,
I think this other post may be helpful:
https://community.atlassian.com/t5/Adaptavist-questions/How-can-I-create-an-email-notification-every-time-an-issue-is/qaq-p/1202606
I do appreciate the response, but one way or another that solution did not work, I did however get it to work using this chunk of code, for future people having the same issue.
import org.apache.log4j.Levelimport org.apache.log4j.Loggerimport com.atlassian.jira.component.ComponentAccessor
def log = Logger.getLogger("com.acme.workflows")log.setLevel(Level.DEBUG)log.info("test message from matt")
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()def previousLabels = changeHistoryManager.getChangeItemsForField(issue, "labels") ? changeHistoryManager.getChangeItemsForField(issue, "labels").last().getFromString(): ""def newLabels = changeHistoryManager.getChangeItemsForField(issue, "labels") ? changeHistoryManager.getChangeItemsForField(issue, "labels").last().getToString():""
log.info("previousLabels : "+previousLabels)log.info("newLabels : "+newLabels)
if (previousLabels != "" && previousLabels.indexOf("test") > -1) {log.info("used to have it...")if (newLabels == "" || newLabels.indexOf("test") == -1) {log.info("and now gone...returning true get email")return true} else {log.info("and still does")}} else {log.info("didnt have it before")}log.info("returning false, no email")return false
It looks like you're new here. Sign in or register to get started.