How to get the parent object field from Task standard object using relationship query. select whatid,what.Email__c from Task. Its showing error. How can I get the email field from various object which is related to Task. If anyone knows help.
Asked
Active
Viewed 395 times
2 Answers
0
Assuming What is a Custom field. Following line will work. __r is usd to refer to parent object.
select whatid ,what__r.Email__c from Task

ClassCastException
- 1,453
- 6
- 15
- 34
0
The solution :
select whatid ,what__r.Email__c from Task
is wrong.
Try this : Select TYPEOF What When Case Then Email__c END from Task
See polymorphic relationships : http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_relationships.htm
-
how to do it with polymorphic relationships when TYPEOF is turned off – vittore Apr 19 '14 at 22:22