Fields Available to an E-mail Template for a Custom Entity

1 minute read time.

I have written before about E-mail Templates in Sage CRM. See "Fields Available in Email Templates".

In one of the comments added to that article, I mentioned that Custom Entities only use the view vSearchListUser. This is not the whole story as that implies that only fields contained in that view are included in the template. That is clearly not the case as we can see from the screenshot below.

The image above shows that fields from the custom entity called 'Event' are available along with fields from the user table drawn from the view vSearchListUser.

In fact we can reference any field from any table that is in context when the template is used. For example in my system I created the custom entity as a child of the Person, Company and Opportunity records.

You can see those relationships within the fields of the custom entity above.

Although we saw that only fields from the custom entity and the user table can be picked from the drop downlist we can nevertheless include fields from other tables just by typing the merge codes (#xxxx_fieldname#) we need.

Below is a screen image that shows a template that has been created that has includes fields from the Company, Person and Opportunity tables. I've also included a reference to an address field which will not be merged.

Template text

[code language="html"]
These will be merged:
Person details: #pers_firstname# #pers_lastname#
Company Details: #comp_name#
Oppo Details: #oppo_description#
Event details: #even_name#
User details: #user_logon#

This will not be merged:
Address Details: #addr_postcode#
[/code]

When the Template is referenced by a user within the context of the Custom Entity, they will also be in the context of the Company, Person and Opportunity so those fields are merged. But the address information is NOT available.

  • I have a custom entity that is 'linked' to a table in another database (one to one link), so is there any way that I can merge fields from the other database table into an email template?

  • Jerome DH - I receive the same error when I add a company field to an email template. My problem is that the company field is not pulling in the drop down selection of available merge fields. I have tried adding views - vSummaryBids and vBids - but no luck. Can you please share what the resolution was?

    Thank you!

  • Hello Jeff,

    I have created an email template for a custom entity (invoice) depending on the person entity.

    When I add a person field in the template, I get an access violation when I select the template in invoice context:

    1 UserActionException,ErrMsg Access violation at address 1A91668A in module 'eware.dll'. Read of address 00000010

    1 : EAccessViolation: Access violation at address 1A91668A in module 'eware.dll'. Read of address 00000010

    1 Creating stack-trace ID:712131013. Error message is "Access violation at address 1A91668A in module 'eware.dll'. Read of address 00000010"

    The issue does not occur when using the template from a group ( view containing invoice and person fields).

    If I remove the person field, the template is working as expected

    What could be the reason of this issue?

    ( Using sageCRM 2017R2)

  • I have the problem that Captions for Custom Entity fields are not drawn. I have a project status with a list behind. I get the code field back but not the caption in the user language. It would be great if there was a way for this to work as it is with other fields.