function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
m22bakerm22baker 

Accessing master record field on a detail trigger without SOQL query

I'm attempting to write a trigger for a detail object that will execute based on a custom field on the master object. Is there a way to obtain the value of this field without using an SOQL query? More specifically, I'm writing a trigger for EmailMessage and want to check a custom field for Case.

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
You can't access any related data without the use of queries. This is the nature of the database.

You'll have to gather together the values of the ParentId field, query those records, then access your custom object.

All Answers

sfdcfoxsfdcfox
You can't access any related data without the use of queries. This is the nature of the database.

You'll have to gather together the values of the ParentId field, query those records, then access your custom object.
This was selected as the best answer
m22bakerm22baker

This is what I thought, but just wanted to double-check with the SF experts.

 

Thanks again