I am trying to do, what I think is, a simple query.
Select Name, Id, CID__c, Account_Executive__c From Account
The 2 custom fields I am able to search by them but my php code is not showing the records for those fields. However, I am also using Eclipse with the salesforce IDE plugin and I with the same query it returns the custom fields records.
Code:
<?php
// SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
// $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
// $PASSWORD - variable that contains your Salesforce.ocm password
define("SOAP_CLIENT_BASEDIR", "soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');
require_once (SOAP_CLIENT_BASEDIR.'/function.php');
require_once ('userAuth.php');
ini_set('soap.wsdl_cache_ttl', '15');
ini_set('soap.wsdl_cache_dir', './wsdl-cache');
try {
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
$query = "Select Name, CID__c, BillingCity, Account_Executive__c From Account a limit 20";
$something = "Select a.Name, a.Id, a.CID__c, a.Account_Executive__c From Account a where CID__c like '125%'";
$createResponse = $mySforceConnection->query($something);
echo "<table border=1 cellpadding=2>";
echo "<tr>";
echo "<th> ID </th>";
echo "<th> Name </th>";
echo "<th> CID </th>";
echo "<th> Account Executive </th>";
echo "</tr>";
foreach ($createResponse as $createResult){
//print_r($createResponse);
//print("<br>");
for ($i=0, $num_result=count($createResult); $i < $num_result; $i++){
echo "<tr>";
echo "<td>";
print($createResult[$i]-> Id);
echo "</td>";
echo "<td>";
print($createResult[$i]-> Name );
echo "</td>";
echo "<td>";
print($createResult[$i]-> CID__c );
echo "</td>";
echo "<td>";
print($createResult[$i]-> Account_Executive__c );
echo "</td>";
echo "</tr";
}
}
echo "<table border=\"1\">";
} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo "</br>";
echo "<h1>faultstring:</h1> </br>";
echo $e->faultstring;
echo "</br>";
return $return;
}
?>
Any help would be greatly appreciated
Bookmarks