I'd like to create a report that presents information such as the EmailMessage.LastOpenedDate and the EmailMessage.Status for emails sent that are related to a specific custom record. When I look in "Report Types" in "Setup", I don't see any way to do that; see "Related To" field on Email Message object not showing in report for a related but unanswered question on this.

Is adding a trigger that copies EmailMessage fields to a custom child object that can then be included in a report the only way to work-around this?

1 Answer 1

  • RelatedTo is a polymorphic field on EmailMessage hence why it is not available on the report type

However ...

  • EmailMessage supports custom fields
  • Thus you could use a Flow or trigger to copy the relevant value(s) from the relatedTo Object (by first checking the key prefix of the RelatedToId) into EmailMessage custom fields
  • Then, your custom report type on EmailMessage would have the requisite data to report on.
  • Thank-you cropredy - a much cleaner approach.
    – Keith C
    Jul 8, 2023 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .