I want to create a Jira Expression that evaluate if an issue is an incident AND if this issue was moved from one specific queue to another one.
I have this for check Incident: issue.issueType.name == "Incident"
And this to check if the issue was moved:
import groovy.json.JsonSlurper
import java.util.logging.Logger
def issueKey = issue.key
def jsonSlurper = new JsonSlurper()
// variável para checar se a transferencia original
def foundStatusChange = true
logger.info("Status: " + foundStatusChange)
// lê as transferencias ocorridas
def changelog = get("/rest/api/2/issue/${issueKey}?expand=changelog")
.header("Content-Type", "application/json")
.asObject(Map)
.body
.changelog
.histories
changelog.each { entry ->
def author = entry.author.displayName
def created = entry.created
def items = entry.items
items.each { item ->
def fromStatus = item.fromString
def toStatus = item.toString
logger.info("${author} moved this issue from ${fromStatus} to ${toStatus} on ${created}")
// teste de origem da transferencia
if (fromStatus != null && toStatus != null) {
foundStatusChange = false
}
}
}
Does there a way to run this on Jira Expression ?
Thank you.
Clecimar