show real values in (draft) email - data fields

Hi

Is it possible to show the actual values in the email before sending the email to a client. Meaning:

When I click on the email address->choose a template, the draft email will show up with the data fields “$contact_first_name $contact_last_name”

i,e, I would like the $contact_first_name $contact_last_name to show up as the real names. It does get converted correctly once the email is sent, but it would be great to see it, before sending the email.

is this possible ?

No, I don’t think it’s possible…

You could try setting up a separate scheme with the “Generate letter” feature, which produces PDF’s from the PDF templates module. but it would be a duplication of what you already have. Still, it might be useful for some checks.

Well if you are into customizing, you could do something like this:

Create a new view for example: view.preview.php

You would need to post the Contact Id to that view, for example, selecting it from a dropdown from all of your contacts. Also you would need to select an ID for an template. Code below is not functional but it could give you some help to achieve what you’re trying to.


require_once('include/MVC/View/SugarView.php');
class MODULEViewPreview extends SugarView
{
    public function display()
    {      
        $ss = new Sugar_Smarty();
        $contact = new Contact();
        $template = new EmailTemplate();

        $contact->retrieve($_POST['contact_id']);
        $template->retrieve($_POST['template_id']);

        if ($template->text_only) {
            $template->subject = $template->parse_template_bean($template->subject, $contact->module_dir, $contact);
            //Parse Body
            $template->body = $template->parse_template_bean($template->body, $contact->module_dir, $contact);
        } else {
            $template->subject = $template->parse_template_bean($template->subject, $contact->module_dir, $contact);
            //Parse Body
            $template->body = $template->parse_template_bean($template->body_html, $contact->module_dir, $contact);
        }
        $ss->assign('template_subject', $template->subject);
        $ss->assign('template_body', $template->body);
        $ss->display('custom/modules/MODULE/tpls/preview.tpl');
    }
}

And in your preview.tpl


 <div id="template">
      <label>{$template_subject}</label>
        <div>
          {$template_body|html_entity_decode}
        </div>
  </div>
1 Like

Hi and thanks

Thanks, I did manage to get the generate letter (pdf) to work, (but its an extra step). I actually like the suggestion of activist the most !

antivist: could you perhaps share your email adress with me ? mine is degar007@gmail.com