Hi there
I'm trying to use the escalation service to notify assignees when they have tickets more than 5 days old. Currently, the JQL/script I am using would send an email for every single ticket found by the JQL.
Is there any way of sending any assignees found by the JQL a single email, with a list of all applicable tickets?
The script I am using is this:
import com.atlassian.mail.Email;
import com.atlassian.mail.server.MailServerManager;
import com.atlassian.mail.server.SMTPMailServer;
import com.atlassian.jira.component.ComponentAccessor;
def subject = "Please review and update aged ticket ${issue.key}"
def body = "Hi ${issue.assignee.displayName} \n\nYou are receiving this email because the issue https://jira.aws.telegraph.co.uk/browse/${issue.key} - ${issue.summary}, is unresolved and more than 5 days old. \n\nPlease review and, where possible, resolve this issue."
def emailAddr = issue.getAssignee().getEmailAddress()
def sendEmail(String emailAddr, String subject, String body) {
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();
if (mailServer) {
Email email = new Email(emailAddr);
email.setSubject(subject);
email.setBody(body);
mailServer.send(email);
}
sendEmail (emailAddr, subject, body)