0
votes

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.

2

2 Answers

0
votes

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 
0
votes

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