User Tools

Site Tools


Writing /app/www/public/data/meta/onboarding/ticketer/send_an_escalation_email.meta failed
onboarding:ticketer:send_an_escalation_email

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
onboarding:ticketer:send_an_escalation_email [2017/07/28 12:53] mmcconboarding:ticketer:send_an_escalation_email [2021/06/25 10:09] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== 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:
 +
 +<code>
 +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",
 + emailSent = false
 + }
 +
 + if(!emailSent){
 +   throw new Exception("GroovletException: Unable to send email. Check Groovlet and/or email functionality")
 + }
 +
 +}
 +</code>