-1

I've got 3 objects => -Object A has a lookup with Object B (Order) -Obect C (case) has a lookup with Object B

I need to retreive a field on Object C to display with all the field from the Object A (with SOQL) in Visualforcepage. Any ideas ? :)

1 Answer 1

1

You'd use two subqueries:

SELECT 
  (SELECT Id FROM A__r),
  (SELECT Id FROM C__r)
FROM B__c
WHERE Id IN (SELECT B__c FROM A__c WHERE Id = :aRecordId)

If you're using pure Visualforce without Apex, you need to have B's ID, instead:

<apex:page standardController="B__c">
  <apex:repeat value="{!B__c.A__r}" var="a">
    {!a.Name}
  </apex:repeat>
  <apex:repeat value="{!B__c.C__r}" var="c">
    {!c.Subject}
  </apex:repeat>
</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .