This is a discussion on List all leads within the Salesforce Coding Discussions forums, part of the Salesforce category; Hey Mike,
I'm trying to view all the spam in our salesforce
-
List all leads
Hey Mike,
I'm trying to view all the spam in our salesforce account. Here's what I got:
PHP Code:
include "loginInfo.php";
require_once ('./includes/soapclient/SforcePartnerClient.php');
require_once ('./includes/soapclient/SforceHeaderOptions.php');
require_once ('./includes/soapclient/SforceBaseClient.php');
$mySforceConnection = new SforcePartnerClient();
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
$mylogin = $mySforceConnection->login($username, $password);
$query = "Select LastName, Id, Email, FirstName From Lead WHERE
Email LIKE '%tivan%' OR
Email LIKE '%ialis%' OR
Email LIKE '%evitra%' OR
Email LIKE '%ropecia%' OR
Email LIKE '%ramadol%' OR
Email LIKE '%alium%' OR
Email LIKE '%iagra%' OR
Email LIKE '%anax%'
Order by Email";
$queryResult = $mySforceConnection->query($query);
$records = $queryResult->records;
if(sizeof($records) > 0)
{
echo "<center><table border=1>\n<tr><th>ID</th><th>Email</th><th>Firstname</th><th>Lastname</th></tr>\n";
foreach ($records as $record)
{
$sObject = new SObject($record);
$id = $sObject->Id;
$first = $sObject->fields->FirstName;
$last = $sObject->fields->LastName;
$email = $sObject->fields->Email;
if(strlen($first) == 0)
$first = "[not provided]";
if(strlen($last) == 0)
$last = "[not provided]";
echo "<tr><td>$id</td><td>$email</td><td>$first</td><td>$last</td></tr>\n";
}
echo "</table></center>";
}
For some reason, I'm only pulling the Id and not the FirstName, LastName and Email. Any ideas on what I'm doing wrong?
Last edited by ncee; 01-26-2009 at 09:57 AM.
Reason: transposed code
-
do a
PHP Code:
echo '<pre>' . print_r($records,true) . '</pre>';
and paste it here so I can take a look at it
That will help see what is going on
~Mike
OR
echo out your SOQL statement and put it into the data loader or eclipse and see if you get any results. Seems like it is a SOQL problem man
Last edited by mike; 01-26-2009 at 11:09 AM.
Reason: adding stuff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
Bookmarks