Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contact lookup via Email field

I am using Force.com Toolkit for PHP (Version 20.0) to integrate with Salesforce.

I would like to lookup some Contact via the email field and print in on page if the condition is met. Here is the query I used:

SELECT Name, Email, npe01__HomeEmail__c, npe01__WorkEmail__c, npe01__AlternateEmail__c FROM Contact WHERE Email = "[email protected]"

In Workbench everything works fine, however, when I use the same query in PHP I get the following error:

'MALFORMED_QUERY: npe01__AlternateEmail__c FROM Contact WHERE Email="[email protected]"
ERROR at Row:1:Column:112
Bind variables only allowed in Apex code'

What would be best practice to help me solve this problem?

Thanks!

like image 982
odedta Avatar asked May 18 '17 14:05

odedta


People also ask

Can you look up a person by their email address?

You can also try one of the many people search services available online. Popular ones are Pipl and Spokeo that help you find a match for the email address that you want to trace. These services use complex searching algorithms that extract a lot of information.

What is an email lookup?

An email lookup tool, or an email finder, is an instrument that allows getting a lead's email address based on their personal data. This may include their name, the company's name, links on social media, and so on.


1 Answers

It turns out that halfwarr was right! I used the following code to get this to work:

$donor_email = '[email protected]';
$query = 'SELECT Name, Email, npe01__HomeEmail__c, npe01__WorkEmail__c, npe01__AlternateEmail__c FROM Contact WHERE Email=\''.$donor_email.'\'';
like image 92
odedta Avatar answered Sep 30 '22 11:09

odedta