I have two Objects object1 & object2.
In object1 there is a field, field1 with Lookup to object2. Now what I need to do is query object2 fields based on the id of field1 How can I perform this query?
|
I have two Objects object1 & object2. In object1 there is a field, |
||||
|
|
|
UPDATE: Let say you know the Id of Object1. So you can read the Field1__c from that Object1 - this will be Id of the Object2.
Now we reading Object2 fields:
Or we can do the same simpler:
I think you can do it like this:
You can read more about lookup relationships at the official doc site: Relationship Queries |
|||||||
|
|
You can also do this thriugh one single query -
|
|||
|
|