+ Reply to Thread
Results 1 to 6 of 6

Thread: Fields not retrieved

  1. #1

    Fields not retrieved

    Hi, Im using partner.wsdl, New to salesforce Im trying to retrieve data in fields but I can't retrieve ID field in any table. I have no problem with other fields though, am I missing something?

    $query = "SELECT Id, OwnerId, SolutionName FROM Solution";

    echo "<table cellpadding=10 border=1>";
    foreach ($queryResult->records as $record) {
    echo "<tr>";
    echo "<td>".$record->fields->Id."</td>";
    echo "<td>".$record->fields->OwnerId."</td>";
    echo "<td>".$record->fields->SolutionName."</td>";
    echo "</tr>";
    }
    echo "</table>";

  2. #2

    Same Issue

    I'm having the same problem, I think.

    After creating a partner session, I'll query:

    Code:
    $query = "SELECT Id, Name from Account";
    $resultObject = $mySforceConnection->query(($query));
    print_r($resultObject);
    and receive an empty response:
    Code:
    QueryResult Object (     [queryLocator] =>      [done] => 1     [records] => Array         (         )      [size] => 0 )
    the strange thing is, I can query a custom object just fine and get all the data I want out of it... it's just the standard objects that won't open up!

    oh yeah, and I've re-downloaded the wsdl files from salesforce, put them on my server, and disabled my php's wsdl caching.
    Last edited by Bryon; 03-18-2009 at 10:15 PM. Reason: add more info

  3. #3
    I'm having success now getting data using the admin credentials, but haven't figured out the difference in the settings between my normal user and the admin.

    lstr, have you tried using administrative login?

  4. #4
    Hi Byron,

    Try this:
    $query_all_products = "SELECT Id, Name from Account";
    $queryOptions = new QueryOptions(500);
    $response = $mySforceConnection->query(($query_all_products), $queryOptions);
    $all_products = $response->records;
    echo '<pre>' . print_r($all_products, true) . '</pre>';

    Hope that helps,
    Lester

  5. #5
    Join Date
    May 2007
    Posts
    502
    Blog Entries
    3
    Gentlemen sorry for the delay in responding, I was taking a well needed small vacation with my wife and kids.

    I just assumed that you would be using admin rights when attempting to retrieve data from Salesforce. The account that you are using has to have API Enabled in the user area before a regular account, non-admin user can access the API via any scripting language.

    It is always better to set all your scripts up with an admin account, that is what I use. Did you have any success with the last code snippet that was left by Lester?

    Thanks for both of you for joining the site, I appreciate it!!


    ~Mike

  6. #6

    Id doesn't go in ->fields

    In the object you get back from SalesForce, look for Id as:
    Code:
    //RIGHT:
    $object->Id
    instead of
    Code:
    //WRONG:
    $object->fields->Id

+ 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.0 RC1 PL1