+ Start a Discussion
etechcareersetechcareers 

Who.Something does not work in my SOQL???

Hi:

   My query does not work:

 

SELECT Id, ActivityDate, Status, Who.MailingCity, Who.MailingState, Who.Email FROM Task

 What is wrong with it? Please advise...

I am guessing Who.MailingCity and Who.MailingState but Why???

 

gm_sfdc_powerdegm_sfdc_powerde

"Who" can refer to either a contact or a lead.     Mailing address fields are applicable only for contact.  That's probably why you are seeing this error.

kiranmutturukiranmutturu

Way absolutely gm_sfdc_powerde, who refers to contact or lead only not any of the belonging fields. U should use whoid in the context of lead or contact. 

 

 

 

 

 

Regards,

 

Kiran

dotnet developedotnet develope

Hi Friend,

 

By seeing your SOQL query, i have some concerns in my mind.

 

1) In that query which object is primary(Master) and Secondary(Child)?

 

when you are writing a query on relationship between objects you should have an idea that on Master query you can define child and as sub query.

 

please find the link related to this.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm