function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tlaappdev1tlaappdev1 

PHP toolkit 1.1 queries not returning all COLUMNS from SELECT statement

I figured I would start a new thread since the previous one wasn't really about this issue

http://community.salesforce.com/sforce/board/message?board.id=PerlDevelopment&message.id=2660

The new field Always_Ship_UPS__c shows up in the describeSObject() result. I also successfully updated the field using $sforce->update().

But when I put it in the field list of a SELECT statement, I don't get an error, but it never shows up in my result, whether or not the field has a value in Salesforce. This is the same thing that happened previously when I tried querying a custom formula field.

Any ideas?

Message Edited by benv on 10-15-2007 04:21 PM

I have this problem exactly several feilds just can not be selected. I ahve the most current WSDL they appear as objects with a describeSObject() but no columns are returning. Hell, I even did a

SELECT Id,fieldname from Account where Id='basdfasd'

and it returned this

Code:
object(stdClass)#7 (4) {
  ["done"]=>
  bool(true)
  ["queryLocator"]=>
  NULL
  ["records"]=>
  array(1) {
    [0]=>
    object(stdClass)#12 (1) {
      ["Id"]=>
      string(18) "basdfasd"
    }
  }
  ["size"]=>
  int(1)
}

 


as you see no feildname field is listed here this totally sucks

Message Edited by Tran Man on 10-17-2007 01:11 PM

tlaappdev1tlaappdev1
same problem here

http://community.salesforce.com/sforce/board/message?board.id=PerlDevelopment&message.id=2649

and other places. I can't imagine anyone actually using this tool in production. Let alone trying to develop with it.
I committted like 4 days to this to find out it is broken... HUH

msimondsmsimonds
Can  you post some of your code so I can get a better idea of what your SOQL statement looks like?
tlaappdev1tlaappdev1
$mySforceConnection = new SforceEnterpriseClient();
 $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
 $mylogin = $mySforceConnection->login(SOAP_CLIENT_UN, SOAP_CLIENT_PW);

  $sql='SELECT Id, Order_Date__c FROM Account WHERE Id = '0015000000XZRBVAA5';
  $response = $mySforceConnection->query(($sql));

var_dump($response);



nothing to it  it just doesn't  report that field Order_Date__c  and various others

originally i found this problem when I selected all fields from a describe and noticed that many where not in the record set even though they where in the sql statement


Its nothing wrong with the query it works fine in sforce explorer but the API doesn't show all the fields you select on

Message Edited by tlaappdev1 on 10-17-2007 10:50 AM

Message Edited by tlaappdev1 on 10-17-2007 10:53 AM

msimondsmsimonds
Can you do me one favor?  can you try this exact same code but this time use the partner WSDL file?

See if that works
SuperfellSuperfell
PHP over aggressively caches the WSDL file, its possible that its still running with the old out of date WSDL that doesn't have your new custom field in it. There's some trick to flushing the cache, although i can't remember the details, its been discussed on this forum before.
msimondsmsimonds
Yes try this at the top of your PHP script:

ini_set("soap.wsdl_cache_enabled", "0");




msimondsmsimonds
This enterprise code works for me:

Code:
<—php
ini_set("soap.wsdl_cache_enabled", "0");


require_once ('./includes/soapclient/SforceEnterpriseClient.php');
require_once ('./includes/soapclient/SforceHeaderOptions.php');
require_once ('adodb.inc.php'); # load code common to ADOdb

//Salesforce Connection information
$wsdl = './includes/soapclient/enterprise.wsdl.xml';
$userName = "email@account.com";
$password = "password";

$client = new SforceEnterpriseClient();
$client->createConnection($wsdl);
$loginResult = $client->login($userName, $password);
$soql = "Select Id, SA_ID__c FROM Account WHERE SA_ID__c = '7421'";

//Processes the query to get account information from Salesforce
$records = get_records($client, $soql);
echo '<pre>' . print_r($records, true) . '</pre><HR>';
exit;



function get_records($connection, $query)
{
    $queryOptions = new QueryOptions(2000);
    $response = $connection->query(($query), $queryOptions);
    // check count to see if we are done
    if ($response->size > 0)
    {
        $records = $response->records;
        // Cycles through additional responses if the number of records
        // exceeds the batch size
        while (!$response->done)
        {
            set_time_limit(100);
            $response = $connection->queryMore($response->queryLocator);
            $records = array_merge($accounts, $response->records);
        }
    }

    return $records;
}

–>

 

tlaappdev1tlaappdev1
still no go with partner wsdl and sforcePartnerClient

I have the ini_set("soap.wsdl_cache_enable","0") so that is not the problem and when I do a describeSObject the fieldname im asking for exists but is still not returned from the sql statement. Im totally at a loss here as it works for  over 2/3 of the fields.

I have full access to all fields so it is not permissions either. I really think it is a problem with the API as it is  happening to other people to with similar code  also.

I also tried adding in the queryOption(2000) to the query function but that didn't do anything

Message Edited by tlaappdev1 on 10-17-2007 12:06 PM

Tran ManTran Man
Does the issue still exist with Enterprise?  Is this a DE org you are testing against by chance?
tlaappdev1tlaappdev1
Yes this issue is with enterprise and I don't know what DE org is


Tran ManTran Man
Ok, let's focus on Enterprise WSDL at the moment.

Can you open up your enterprise wsdl file and confirm that all your fields are there?

Can you post as much as your code as possible up to the point where it does the query including the ini_set("soap.wsdl_cache_enabled", "0"); statement?

A DE org is a developer edition org.
tlaappdev1tlaappdev1
This is a Paid Enterprise License not Developer. I Confirm that the feild exists in the WSDL FYI I got the feilds orgiinally from a describe on the object and grabbing the names of the columns.

Here is a cut down version of what I have with the results that I just ran and got the same message

ini_set("soap.wsdl_cache_enabled", "0");
require_once('./SforceBaseClient.php');
require_once('./SforceHeaderOptions.php');
require_once('./SforceEnterpriseClient.php');
$user="user";
$pass="pass";
$wsdl="whereitis";

$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection($wsdl);
$mylogin = $mySforceConnection->login($user, $pass);

$sql="SELECT Id, ORG_1st_Order_Date__c FROM Account WHERE Id = '0015000000XXXXXXX'";
$response = $mySforceConnection->query(($sql));
echo "<pre>";
var_dump($response);


// get column names

$stuff=$mySforceConnection->describeSObject("Account");

$fields=get_object_vars($stuff);
foreach ($fields['fields'] as $field){
    $keys=array_keys(get_object_vars($field));
   
    $f=get_object_vars($field);
    $cols[]=$f['name'];

}
var_dump($cols);
exit;


here is the results of the first trust me it shows up in the describeSObject


object(stdClass)#7 (4) {
["done"]=>
bool(true)
["queryLocator"]=>
NULL
["records"]=>
array(1) {
[0]=>
object(stdClass)#8 (1) {
["Id"]=>
string(18) "0015000000XXXXXXX"
}
}
["size"]=>
int(1)

}

Tran ManTran Man
I sent you an email, the one associated with your profile.  I will need to try to debug this locally.
tlaappdev1tlaappdev1
OK for enterprise and from my experience Partner Connections null fields are not returned as part of the record object so this was a false report.

Thanks to Trans for figuring it out and he said he would update the API docs to make it aware that even if you select a NULL or nill feild it does not return as part of the object.

Wow what a relief

benvbenv
The ini_set("soap.wsdl_cache_enabled", "0"); code seems to have solved it for me. Thanks Mike!
msimondsmsimonds
Ben

i am glad that worked for you!   Hope your other problems get resolved too!

~Mike
benvbenv
Mike, for the record, yes my other issue was resolved as well. My only other problem besides the missing fields in the queries (due to WSDL caching) was my inability to use describeSObject. For some reason I had to use describeSObject(array("sObjectType"=>"product2")) instead of describeSObject("product2").