0

How can I match for phonenumber in my whereclause?

My query:

SELECT id, Membership_number__c, Phone, Email FROM Contact WHERE Phone = :phoneNumberString

Above mathces fine on these phonenumber values: +4550516254

004550516254

50516254

But not this one:

4550516254

Any ideas? Just to clarify, the query doesn't return the same record for the three "matching" cases, but it can actually return a record. The latter one, can't.

  • I don't suppose you've tried FIND {+4550516254} IN PHONE FIELDS RETURNING Lead(Id, Membership_Number__c, Phone, Email)? – sfdcfox Jun 8 '15 at 17:19
  • Now I'm quite sure that this is actually not an issue with the query. It seems like if I include the plussign, when I call the method through Execute Anonomously it works. But problenm occurs when the URL parameter which I use as input in my Search Query has a plussign in it. I know that the plussign should actually be: %2B when it's in the URL, is there somehow i can treat it as a plussign or do I need to modify the URL – Claus Machholdt Jun 9 '15 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.