Custom Email Variables in SugarCRM

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 and place that 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.

14 Responses to Custom Email Variables in SugarCRM

  1. Great post. Can’t wait to read the next ones :)

  2. Nice. Thanks for sharing such great details.

  3. can you share how you actually accomplished this? we’re trying to determine how to do related variables. thanks!

    • Amanda

      Hi Steve,

      We manually defined template variables, then developed additional logic that parsed outgoing emails for our defined variables, replacing them with the data we wanted. We will have someone follow up to answer any specific questions. Thanks for your comment!!

  4. Thanks a lot for sharing a great post on Custom Email Variables in SugarCRM. This is very helpful for a newbie like me.

  5. Hi Amanda:
    thanks for your useful post.
    I have added a field to Tasks module.
    How I can insert value of my field into the template?

    • Amanda

      Hi Mohsen,

      To add a new email variable we have to write custom logic. It took a couple of hours to do this for our client and could be replicated pretty easily. It can’t be done in studio and would need to be done by a developer. Let us know if that’s something you’re interested in!

  6. Hi,

    I have created a email template in sugarcrm, in that i have inserted a variable $contact_first_name, after that i have tried to send that template to my business email, but the variable its not populating the data, whereas the gmail and yahoo mails are populating the data, can any one help me out from this…..

  7. I am interested in knowing how to create variables for case_number and user for Cases

    How do you accomplish this?

    • Amanda

      Hi Buck,

      We can provide developer training on this if you are interested in learning how to create custom email variables in Sugar. We can also customize this for you if you aren’t a developer. Please email if you’d like to discuss either of those options. We’re happy to help!

  8. Hello Amanda,

    I am a developer and I am wondering on how to avail the training on custom email variable in Sugar.

    Please let me know. Thanks!

Post Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>