function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sunny.kapoor1306sunny.kapoor1306 

Lookup field calling

I have lookup relation in lead,so how to call that field in soql query

Navatar_DbSupNavatar_DbSup

Hi,

 

Relationship queries traverse parent-to-child and child-to-parent relationships between objects to filter and return results. They are similar to SQL joins.

 

For example

 

Basic Child-to-Parent


SELECT Id, LastName, FirstName, Account.Name FROM Contact

 

Basic Parent-to-Child

 

SELECT Id, Name, Amount,(SELECT Quantity, UnitPrice, TotalPrice FROM OpportunityLineItems)FROM Opportunity

 

Use the below link for more detail:

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

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

sunny.kapoor1306sunny.kapoor1306

thanks sir

 

 

actually there are few fields in tasks like who,what

they hav a lookup relation in lead,i am having problem showing them thru my query

Navatar_DbSupNavatar_DbSup

Hi,

You can try the below SOQL query on task object:

 

List<task> t=[select id,subject from task where whoid='00Q90000006dye8'];//pass the leadid 

system.debug('#####'+t);

SaxonSaxon

Hi Sunny,

 

Is your query working fine?

 

Regards,

Saxon.

sunny.kapoor1306sunny.kapoor1306

@saxon

yup

 

now 1 more work is there

i have to get those leads who are assigned task along with lead's custom fields

 

*with the help of ur soln i have obtained the lead names but lead custom fields i hav to do