+ Reply to Thread
Results 1 to 3 of 3

Thread: Getting nested field values

  1. #1
    vdanvoye is offline Junior Member
    Join Date
    May 2009
    Posts
    2

    Getting nested field values

    Hi,
    I've only just started with the PHP toolkit, so forgive my ignorance

    How could I have access to the field value [Email__c] in the output below:

    QueryResult Object
    (
    [queryLocator] =>
    [done] => 1
    [records] => Array
    (
    [0] => SObject Object
    (
    [type] => Inco_Pax__c
    [fields] => stdClass Object
    (
    [Workshop_Title__c] => MK02.01 CMM Module II Class ID 61739
    [Town__c] => Brugge
    [SystemModstamp] => 2009-05-29T08:32:48.000Z
    [Start_Date__c] => 2009-01-18
    [Salutation__c] =>
    [SQ__c] => 1536875
    [Person__c] => 003S0000004IwoIIAS
    [OwnerId] => 00520000000hRVEAA2
    [Outing_ref__c] => a03S0000000rLlkIAE
    [Name] => I_0004
    [Last_name__c] => Danvoye
    [LastModifiedDate] => 2009-05-29T08:32:48.000Z
    [LastModifiedById] => 00520000000hRVEAA2
    [Job_title__c] =>
    [IsDeleted] => false
    [First_name__c] => Vincent
    [Email__c] => vdanvoye@xxx.com
    [CreatedDate] => 2009-05-29T08:32:48.000Z
    [CreatedById] => 00520000000hRVEAA2
    [Country__c] =>
    [Company__c] => Last Company created via Salesforce
    [Company_SQ__c] =>
    [Account__c] => 001S00000052MNsIAM
    )
    [Id] => a0KS0000000IU6EMAW
    )
    [1] => SObject Object
    (
    [type] => Inco_Pax__c
    [fields] => stdClass Object
    (
    [Workshop_Title__c] => Advanced Finance
    [Town__c] => Seloignes
    [SystemModstamp] => 2009-05-29T11:31:49.000Z
    [Start_Date__c] => 2009-05-31
    [Salutation__c] => Mr
    [SQ__c] => 1536874
    [Person__c] => 003S0000004IrRfIAK
    [OwnerId] => 005S0000000EBSrIAO
    [Outing_ref__c] => a03S0000000rLm5IAE
    [Name] => I_0003
    [Last_name__c] => Danvoye
    [LastModifiedDate] => 2009-05-29T11:31:49.000Z
    [LastModifiedById] => 005S0000000EBSrIAO
    [Job_title__c] =>
    [IsDeleted] => false
    [First_name__c] => Vincent
    [Email__c] => vdanvoye@sxxx.com
    [CreatedDate] => 2009-05-28T14:53:40.000Z
    [CreatedById] => 005S0000000EBSrIAO
    [Country__c] => Belgium
    [Company__c] => CompanyX
    [Company_SQ__c] =>
    [Account__c] => 001S00000055KoAIAU
    )
    [Id] => a0KS0000000IU5fMAG
    )
    )
    [size] => 2
    )

    Many thanks for any clue you can provide on this!

    Vincent

  2. #2
    vdanvoye is offline Junior Member
    Join Date
    May 2009
    Posts
    2
    Nevermind, figured it out in the end. For those interested:

    PHP Code:
    try {
      
    $client = new SforcePartnerClient();
      
    $client->createConnection($wsdl_src);
      
    $loginResult $client->login($userName_src$password_src);
      
    $query "Select i.Workshop_Title__c, i.Town__c, i.SystemModstamp, i.Start_Date__c, i.Salutation__c, i.SQ__c, i.Person__c, i.OwnerId, i.Outing_ref__c, i.Name, i.Last_name__c, i.LastModifiedDate, i.LastModifiedById, i.Job_title__c, i.IsDeleted, i.Id, i.First_name__c, i.Email__c, i.CreatedDate, i.CreatedById, i.Country__c, i.Company__c, i.Company_SQ__c, i.Account__c From Inco_Pax__c i";
      
    $records get_records($client,$query);
      if (
    $records)
      {
       echo 
    '<p>There are currently ' count($records) . ' inco participants defined.<br><br>';
        foreach (
    $records as $record){
         
    $sObject = new stdclass($record);
         
    $First_name__c $record->fields->First_name__c;
         
    $Last_name__c $record->fields->Last_name__c;
         
    $Email__c $record->fields->Email__c;
         
    $Outing_ref__c $record->fields->Outing_ref__c;
         
    $Account__c $record->fields->Account__c;
         echo 
    "First name: $First_name__c<br />";
         echo 
    "Last name: $Last_name__c<br />";
         echo 
    "Email address: $Email__c<br />";
         echo 
    "Outing: $Outing_ref__c<br />";
         echo 
    "Account: $Account__c<br /><hr size='1'><br />";
        }
      }

    } catch (
    Exception $e) {
      
    print_r($client->getLastRequest());
      echo 
    $e->faultstring;

    All the posts in this forum have been of great help!

    Vincent

  3. #3
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15

    Thumbs up Cool and Thanks

    Vincent,

    Sorry for the delay in posting, I have been hammered at work and could not get to the site at all for the past few days. I am glad that you worked it out and thanks for joining the site, I really appreciate it.

    Let me know if there is anything else you need help on and I will try and get here much faster!


    ~Mike

+ Reply to Thread

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.1