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

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

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

  • Comments 8
  • Likes

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 screen shot 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#

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.

  • Hi Jeff,

    what happen when we had more then one Search Select Advanced field on the entity Person?

    My Result with Sage CRM 7.1 SP2 is that I can't reference into the person entity.


  • I don't understand your question.

  • I have a custom Entity "Event"

    SSA      even_person1 -> Eventmanager

    SSA      even_person2 -> Eventmanager_Help

    And now you have two personid.

    What could I do that this is still working? Are there any plans for making this based on a view like the standard?


  • I don't know!  I don't have an answer.

  • 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.

  • 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<br />

    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)

  • Jerome

    You will need to log that as a case.

  • 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!