Skip to main content
I am trying to fetch the field EmailTemplateId from the EmailMessage object. As per the Salesforce docs, the EmailTemplateId is a reference type of a field. Can someone please help me with the query for the same. I have tried the below query but it is failing.

Select Id , (Select Subject from EmailMessage) From EmailTemplate

INVALID_TYPE:

Select Id , (Select Subject from EmailMessage) From EmailTemplate

^

ERROR at Row:1:Column:34

Didn't understand relationship 'EmailMessage' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.

EmailMessage has a child relation with EmailTemplate(attached screenshot)

What is the relationship between EmailTemplate and EmailMessage objects.This is blocking us. Could someone please provide the correct query.
3 answers
0/9000