I'm trying to construct a query on Event to retrieve some custom fields on Opportunity in the same query as the Event fields. The "
WhatID" is the
WhoID is unrelated to the Account. The
OwnerID owns the Opportunity.
I keep getting the error message that Apex doesn't understand the relationship of
Opportunities__r, etc., regardless of what I seem to do; including enclosing that portion in a separate sub select.
Here's what I want to select:
Assnmnt = [select Id, OwnerID, Owner.Name, Subject, ActivityDateTime, ActivityDate, DurationInMinutes, StartDateTime, EndDateTime, Description, WhatID, WhoID, Who.Name, What.Opportunity.Account_Address__c, What.Opportunity.Account.Name, What.Opportunity.Account_Phone__c, Opportunty__r.Customer_Contact__c from Event Where Id =: Asn2Create and WhatId =: What.Opportunity.Id];
Any help on how to properly construct this to work would be appreciated.