Extending EmailTemplates to add Cases Module in Sugar 7.9.5, Parsing Email not working

I was able to add the case modules variables in the email template Reference Insert Opportunity variables into Email Templates ) , I'm not able to parse the emails,

I did try overriding function email2Send in modules/Emails/Email.php .   

in custom/modules/Emails/customEmail.php

require_once ('modules/Emails/Email.php');

   class CustomEmail extends Email {

      function email2Send($request) {

         /* added $_REQUEST['parent_type'] == 'Cases' */

   }

}

But its still not parsing the values

Any help is appreciated

  • Try changing variables in this pattern.

    $cases_name =>$acases_name

    $cases_description=>$acases_description

    actually cases should be replaced by acases.

  • Hi, I know this answer is too late, but you are just looking for the parse_template function.

    You are looking for these three lines:

    $this->description_html = EmailTemplate::parse_template($this->description_html, $object_arr);
    $this->name = EmailTemplate::parse_template($this->name, $object_arr);
    $this->description = EmailTemplate::parse_template($this->description, $object_arr);

    You will need to unset the 'Emails' key in $object_arr, and fill it with a 'Cases' key where the value is the id of the associated Case.

    For those using Sugar 8.0.X, it's similar, but instead the template parsing actually happens quite a bit late in the file in the sendEmail function:

            $this->name = EmailTemplate::parse_template($this->name, $related);
            $this->description_html = EmailTemplate::parse_template($this->description_html, $related, true);
            $this->description = EmailTemplate::parse_template($this->description, $related);