Custom Email Variables in SugarCRM

sugarcrmdevelopers —  March 7, 2011

Editor’s Note: This post is republished with permission from the blog of SugarCRM Gold partner Epicom. It shows a customization they have done to leverage variables from their Sugar data in composed emails.

Custom Email Variables Allow Epicom Customers To Easily Compose Emails Using Data Stored In SugarCRM

Epicom has created custom email variables in SugarCRM for several clients. An email variable is an ID tag that will pull in data from your CRM for Accounts, Contacts, Leads, Targets, and Users. When creating email templates, users can choose an email variable that will automatically pull in fields from certain modules in SugarCRM. For example, in the greeting of the email a user can place a variable for a contacts name after “Dear” and SugarCRM will automatically fill in that data based on email comparison for the person receiving that email.

SugarCRM includes some email variables for templates as mentioned above. However, some variables for existing modules, custom fields, and custom modules aren’t included. Some of Epicom’s clients needed the ability to pull data into email templates that wasn’t available with Sugar out-of-the-box.

Sugar’s flexibility made it easy for Epicom to create any variable related to any field or module in the CRM system. One of Epicom’s clients needed custom variables created  to allow greater integration between email templates and the cases module in SugarCRM. This would allow them to quickly pull information out of the cases module and into email templates.

Some examples of custom email variables that Epicom created for that client included:

  • Case Number
  • Job Number
  • Account Name Related to the Case Number
  • Address of the Account Related to that Case

When a user is on a case and clicks “Compose Email” from the activities subpanel, they will be able to click “Options” then choose a template from the drop-down, which will bring in the saved template that Epicom created with the variable identifiers {case_number}, {job_number},{account_number}, etc. When the email is actually sent out, it will replace those variables with the proper data. In this instance, the email variables needed to pull from the cases module in SugarCRM. So in order to follow standard Sugar behavior for email variables, the subject of the email template needed to start off with “[Case:xxx]” where xxx is the case number. This is how SugarCRM knows which case to grab the data from and “[Case:xxx]” will disappear once the email is sent by the user.

The ability to pull any information from your CRM into an email saves users time and brings more value to emails by relating more data to the receiving contact. For more information about custom email variables, contact us at or call (512) 481-9000.