You need to sign in to do that
Don't have an account?

SOQL query does not return all the fields
Hi,
I have a custom object called Invoice__c and the fields that it has are Amount_Outstanding__c,Amount_Paid__c,Id,Invoice_Date__c,Name,Payment_Status__c,Related_Job__c
Whenever I do a query using the PHP toolkit 20, it only returns the Id for some reason. My query works fine in workbench.developerforce.com, but whenever I run $options = new QueryOptions(200);$mySforceConnection->setQueryOptions($options); $response = $mySforceConnection->query($query);
Only id is returned as response. Can somebody please help me figure out what the problem is. I have attached my function below:
function update_invoice($mySforceConnection){ echo"**************************************<br>"; echo"started updating invoice table<br>"; try { $query = "SELECT Amount_Outstanding__c,Amount_Paid__c,Id,Invoice_Date__c,Name,Payment_Status__c,Related_Job__c FROM Invoice__c ORDER BY CreatedDate DESC NULLS FIRST"; $options = new QueryOptions(200); $connection = mysql_open(); //opens a connection $mySforceConnection->setQueryOptions($options); $response = $mySforceConnection->query($query); print_r($response); !$done = false; //echo "Size of records: ".$response ->size."\n"; if ($response->size > 0) { while (!$done) { foreach ($response->records as $record) { $insert = "insert into invoice__c(Id, Name, Related_Job__c,Invoice_Date__c, Amount_Paid__c, Amount_Outstanding__c, Payment_Status__c) " . "values ('$record->Id', '$record->Name', '$record->Related_Job__c', '$record->Invoice_Date__c', '$record->Amount_Paid__c','$record->Amount_Outstanding__c', '$record->Payment_Status__c')";//query for insert $result = @mysql_unbuffered_query($insert, $connection) or show_error() ; } if ($response->done != true) { echo "***** Get Next Chunk *****\n"; try { $response = $mySforceConnection->queryMore($response->queryLocator); } catch (Exception $e) { print_r($mySforceConnection->getLastRequest()); echo $e->faultstring; } } else { $done = true; } } } } catch (Exception $e) { print_r($mySforceConnection->getLastRequest()); echo $e->faultstring; } echo"finished updating invoice table<br>"; mysql_close($connection);//close connection }
The result by doing a print_r($response) gives me
QueryResult Object ( [queryLocator] => [done] => 1 [records] => Array ( [0] => SObject Object ( [type] => [fields] => [Id] => a01U0000000i4YSIAY ) ) [size] => 1 )
cheers
moh3en