User Tools
onboarding:ticketer:send_an_escalation_email
Table of Contents
Send an escalation email
Author: Michelle McCausland
Introduction
This page will describe the implementation that is in place for the Vendor Certification project's email escalations.
The aim of this is to provide a resource to work from should this behavior be required some where else.
In this context the email escalation refers to the following section of the workflow manager:
Groovlet
This task was undertaken as part of SUPPORT-465 where further detail is available about this task.
As of July 2017 the groovlet is located here: Groovlet ID 1985
Here is the groovlet in it's entirety:
arg, defaultArg, ticket ->
/*
SUPPORT-465 - Vendor Certification Esclation Emails
This groovlet is used to send a ticket email using a custom email template to a group of users who should be notified about a ticket.
If the groovlet fails to fully execute, any exceptions thrown will be sent to the "Failure email address" listed
*/
log.info "Default arg: $defaultArg"
log.info "Argument: $arg"
log.info "Ticket: $ticket"
def customEmail = com.errigal.ticketer.CustomEmail
boolean emailSent = false
def emailService = com.errigal.ticketer.utils.DomainUtils.getGrailsService('emailService')
com.errigal.ticketer.Ticket.withSession { sess->
def entranceEmailName = "Vendor Certification Escalation"
/* Had to use getCustomEmailVOWithoutSecurityCheck as this does not check the security subejct
which for some reason is not being returned in the thread when using escalation as the groovlet type*/
def emailVo = emailService.getCustomEmailVOWithoutSecurityCheck(ticket?.id, entranceEmailName)
def email = customEmail?.findByName(entranceEmailName)
def customEmailTemplate = new com.errigal.ticketer.mail.CustomEmailTemplate(email, emailVo)
/* Setting the user string at this point as the user is not returned by the session */
customEmailTemplate?.setSentByUser("auto")
sess.flush()
try{
emailService.sendEmail(customEmailTemplate)
log.info "<<<<<<<<<<<<<<<<DONE sending email: " + entranceEmailName + "."
emailSent = true
}
catch(Exception e){
log.error "Unable to send email in Groovlet", e
emailSent = false
}
if(!emailSent){
throw new Exception("GroovletException: Unable to send email. Check Groovlet and/or email functionality")
}
}
onboarding/ticketer/send_an_escalation_email.txt · Last modified: 2021/06/25 10:09 by 127.0.0.1