Skip to main content
edited tags
Link
David Reed
  • 93.7k
  • 14
  • 90
  • 166
edited tags
Link
Source Link

Result of a soql parent to child soql request

I would want to know how I can display the result from a soql child to parent request? My request is:

$query = "SELECT FirstName, LastName, (select Retreat_Booking__c.Retreat__c from Retreat_Bookings__r)FROM Contact";
$response = $mySforceConnection->query($query);


$queryResult = new QueryResult($response);
while($queryResult->current()->FirstName!='' || $queryResult->current()->LastName!='')
{
    echo $queryResult->current()->FirstName." ".$queryResult->current()->LastName." ".$queryResult->current()-> Retreat_Bookings__r->Retreat_Booking__c->Retreat__c." <BR/>";
    $queryResult->next();
}

The request works and display FirstName and LastName but not Retreat__c. I know the result in the 2nd select is a json and I tried many things, but nothing works.

Is somebody can help me please? Thanks a lot in advance!!