I am trying to retrieve the records from a query that includes a nested query. I am able to retrieve all of the results from all other parts of the query, just not the one from the nested query. The issue may also include that the name of the field is the same as two others, although it holds a different value.
This is my query:
$query = "SELECT Name,Opportunity.Account.Name,CloseDate,(Select Name from Sales_Order_Information__r),Opportunity_ID__c,Product__c,Country__c,Opportunity.End_User_Requested_Delivery_Date__c from Opportunity Order By Opportunity_ID__c ";
The name from Sales_Order_Information_r is where I am encountering my issue.
This is how I am retrieving results:
$options = new QueryOptions(200);
$mySforceConnection->setQueryOptions($options);
$response = $mySforceConnection->query($query);
!$done = false;
if ($response->size > 0) {
while (!$done) {
foreach ($response->records as $record) {
echo $record->Name ; //Opportunity Name (works)
echo $record->Account->Name //Account Name (works)
echo $record->Sales_Order_Info__r->Name; //Sales_Order_Info Name **(doesn't work)**
The error I am receiving is:
Notice: Undefined property: stdClass::$Sales_Order_Info__r in (Location)
Notice: Trying to get property of non-object in (Location)
Any help would be appreciated.
from
:Opportunity.End_User_Requested_Delivery_Date__c, from Opportunity
foreach($record->Sales_Order_Infor__r as $item){echo $item->Name;}
Salesf_Order_Information__r