+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
This is a discussion on Displaying Child Records in A Nested Query within the Salesforce PHP Tutorials forums, part of the Salesforce category; Hi this is retun I get from the print response I can
  1. #11
    t14
    t14 is offline Junior Member
    Join Date
    Jan 2010
    Posts
    11
    Hi this is retun I get from the print response

    I can access the contacts object information with
    PHP Code:
    echo $record->fields->Name 
    But I can not access the Accounts object information with
    PHP Code:
    echo $record->Account->id 
    I get this error message
    Notice: Undefined property: SObject::$Account in C:\wamp\www\sftest.php on line 21

    I am using php 5 and also the sforce partner client toolkit version 13.1

    Code:
       QueryResult Object
      (
          [queryLocator] => 
          [done] => 1
          [records] => Array
              (
                  [0] => SObject Object
                      (
                          [type] => Contact
                          [fields] => stdClass Object
                              (
                                  [Name] => Steve
                                  [Email] => s.l@test.co.uk
                                  [Login__c] => s.l@test.co.uk
                                  [Password__c] => pwd
                                  [PR__c] => Client 
                                  [0] => SObject Object
                                      (
                                          [type] => Account
                                          [fields] => stdClass Object
                                              (
                                                  [Name] =>  GTYU
                                              )
      
                                          [Id] => 0012000000000000
                                      )
      
                              )
      
                          [Id] => 0032000000000000
                      )
      
              )
      
          [size] => 1
      )

  2. #12
    t14
    t14 is offline Junior Member
    Join Date
    Jan 2010
    Posts
    11
    Hi
    In case anyone runs into a similar problem.

    Based on my results of the print_r I posted above I could not access the Parent object feilds with $record->Account->Id.

    Instead I used this below;
    $record->fields->{0}->Id
    $record->fields->{0}->fields->Name

    to access the child object values I used
    $record->Id
    $record->fields->Name

    I am not to sure why but my print_r values where different from the examples here even though I used a similar query.

    Thanks T

  3. #13
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    The reason that your print_r results are different from some of the ones that are posted on this site is due to when the examples were posted. The PHP Tool Kit has changed over the past few years and the print_r results are different when the toolkit has been changed or updated.

    Hope that makes sense

+ Reply to Thread
Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2