I am trying to figure out how long a ticket has been in a certain status. I am sure it is something simple that I am missing..
Here is what I have so far:
project = XXXX ssuetype in standardIssueTypes() AND status in (Open, "In Progress", "On Hold", Intake, New, "HLE Estimate", "HLE Proposed", "HLE Approved", "DLE Estimate", "DLE Proposed", "DLE Approved", "DLE Reviewed", "HLE Reviewed") AND created >= 2021-01-01 AND created <= 2023-02-28 ORDER BY created DESC
Can anyone help me find the time in the current status?
Henning, that was a perfect suggestion. Thank you!
Inside of our Script Runner Event Listener, we set the 'To issue fields' to 'customfield_10700'. Custom Field ID 10700 is a scripted field:
//THIS CUSTOM FIELD CONTAINS THE TARGETS FOR OUTGOING SMS ALERTING: //P1 -> oncall all the time //P1 -> primary-secondary during biz hours //P2 -> primary-secondary during biz hours //P3, P4 -> no SMS sent //ESCALATED -> escalatedpager@spkaa.com import com.atlassian.jira.project.Project import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.project.ProjectManager import com.atlassian.jira.security.roles.* Date now = new Date()
//create empty notifyList string def notifyList = ""
//Create new objects used for determining ticket project and roles and roleActors (users in role)
Project myProject = issue.getProjectObject()
ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager cfManager = componentManager.getCustomFieldManager()
CustomField cf = cfManager.getCustomFieldObject(10207) //Escalation Status custom field
ProjectRoleManager roleManager = componentManager.getComponent(ProjectRoleManager.class)
ProjectRole role = roleManager.getProjectRole("Primary-Secondary-Email")
ProjectRoleActors actors = roleManager.getProjectRoleActors(role, myProject)
//For a P1 during business hours, add Primary-Secondary-Pager and ONCALL
if ((now.hours >= 9) && (now.hours < 18) && issue.priority.name.contains("P1")) {
role = roleManager.getProjectRole("Primary-Secondary-Pager")
actors = roleManager.getProjectRoleActors(role, myProject)
actors.getUsers().each { i ->
notifyList += i.getEmailAddress() + " "
}
notifyList += "emergencypager@spkaa.com "
}
//For a P1 AFTER business hours, add ONCALL
if ((now.hours < 9) && (now.hours >= 18) && issue.priority.name.contains("P1")) {
notifyList += "emergencypager@spkaa.com "
}
//For a P2 during business hours, add Primary-Secondary-Pager.
if ((now.hours >= 9) && (now.hours < 18) && issue.priority.name.contains("P2")) {
role = roleManager.getProjectRole("Primary-Secondary-Pager")
actors = roleManager.getProjectRoleActors(role, myProject)
actors.getUsers().each { i ->
notifyList += i.getEmailAddress() + " "
}
}
//If the ticket is ESCALATED, include escalate@spkaa.com
if (issue.getCustomFieldValue(cf).toString() == "Escalated") {
notifyList += "escalatedpager@spkaa.com "
}
return notifyList
We use this to ensure that the P1 and P2 helpdesk tickets notify the correct people - and limit the notifications after business-hours. We also use this with the Escalate Ticket built-in script as part of our "Escalation System" in case anything gets missed.
The //For a P2 during... block is a good example of getting all email addresses for a ticket's project role named "Primary-Secondary-Pager", in case someone is looking for just that piece.
Maybe you could create a scripted custom field which "calculates" to correct receiver for the issue and than use this field as "To:".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.