I am writing a callout=true function that will be calling an external service with some data collected from Salesforce. Since callout functions can't receive complex objects as arguments, and I have to pass through data from Case, Account and Contact objects related to the case, I wanted to save some SOQL limits and extract the Contact.Email field from the Case SOQL query (as referenced here, for example).
However when I went ahead to test this, here is what I get:
Case[] a = [SELECT Contact.Email FROM Case WHERE CaseNumber = '00007278'];
system.debug(a);
output:
|USER_DEBUG|[2]|DEBUG|(Case:{ContactId=003R000001Vt6e1IAB, Id=500R000000CR30UIAT})
The contact definitely does have an email address, so that's not the problem. Is this something that is no longer possible? Will I have to make a separate query for this? This is a very strange behavior, because I assumed that if I can't get contact.email from the query the query would error out instead of returning the Id of the object.