+ Start a Discussion
marchandojmarchandoj 

Help writing an SOQL Query linking Activities and Leads

Hi

I'm trying to write a query which will pull back a custom field from leads for a specific set of activities

I've tried the query below but cannot figure out how to tunnel into the Leads table to get at the field i want (Solution_Type__c)

Can someone help me?

 

SELECT Id, subject, Who.Name, Who.Id.Solution_Type__c  FROM Task Where Webform_completed__c != NULL AND CreatedDate = Last_month And IsDeleted != TRUE

Maros SitkoMaros Sitko
the easy way is ask for Solution_Type__c in second query, because who id can be populated with contact id. In other way you must use TYPEOF

http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm?SearchType=Stem