Insert Opportunity variables into Email Templates

I'm trying to create an Email Template for use in the Opportunities module, but the only variables that are available are from the Contacts,Lead,Target,Accounts,User, and Current User modules.

Is there a way to add modules to use variables from?

Thanks!

SugarCRM Enterprise 7.9.2.0 - On Premises

Parents
  • hats

    Thanks for your reply, but I couldn't get that to work for me. I'm sending the email via the 'Create' plus mark inside an Opportunity record. The email is associated with the Opportunity record, but it looks like the variables are never parsed for replacement.

    I've tried all of these without success (both in the subject and in the body of the email). They're not even replaced in the email; eg: the variables still appear to the person who received the email:

    $opportunities_name
    $Opportunities_name
    $Opportunity_name
    $opportunity_name
    {::Opportunities::name::}

    The variables for Accounts are parsed (and show up empty), so I know Sugar is looking through the email. Am I missing something? Thanks again.

  • Hi John Bievenour,

    Sorry, the solution I suggested works only if you parse the email template using bean initialization.

    To show fields from additional module in Email Template create, you need to override EmailTemplate bean (modules/EmailTemplates/EmailTemplate.php) and EditView.php (modules/EmailTemplates/EditView.php) and include your new module in dropdown list and initialize it's bean.

    Let me know if you are interested in code-level customization and I will point out the functions you need to modify.

    Regards.

    Hats

  • Thank you for the help,hats. I looked through both of those files and can begin to see what might need changing, but if you wouldn't mind pointing out the functions that need modification I'd really appreciate it.

Reply Children
  • Hi John Bievenour,

    You should look out for generateFieldDefsJS() function in EmailTemplate.php file (modules/EmailTemplates) and initialize opportunity module bean there.

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    Then, in EditView.php, look out for $dropdown variable and add "Opportunities" as one of the options to existing list.

     {SugarClub Administrator Edit: We're sorry, but this image is no longer available}  

    To make these changes upgrade safe, you need to copy EditView.php to custom/modules/EmailTemplates/EditView.php and also need to override EmailTemplate bean and then generateFieldDefsJS method. Please follow below thread to override EmailTemplate bean class.

    How to override bean class in EmailTemplate? 

    Let us know if this helps.

    Happy Holidays !

    Regards.

    Hats