====== 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: {{ :onboarding:ticketer:email_escalation.png?nolink |}} ---- ===== Groovlet ===== This task was undertaken as part of [[https://errigal.atlassian.net/browse/SUPPORT-465|SUPPORT-465]] where further detail is available about this task. As of July 2017 the groovlet is located here: [[http://54.241.1.251:8083/Ticketer/groovlet/show/1985|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 "<<<<<<<<<<<<<<<