function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
User UsersUser Users 

Finding a contact by phone number

Hi All,

I am trying find a contact by phone number.

I'm able to find a Contact whose phone# is exactly xxxxxxxxxx or something like +xxxxxxxxxx but it can't match numbers like:

91xxxxxxxxxx(Start with country code)

xxx-xxx-xxxx

(xxx)  yyy - zzzz(multiple embedded blanks)

So, in case the phone number is not stored in correct format, the contact is not found even though the phone number is basically the same.
DeveloperSudDeveloperSud
Hi ,

Did you try with 'LIKE' in your query string.As I have checked your requirement in my dev org it seems we can use like operator for your requirement for query out those contacts with phone numbers like +91********** or (415) ***-****.

Query it like below : select name ,phone from contact where phone LIKE '+91%' 
                              select name ,phone from contact where phone LIKE '(415)%' 
Ilayaraja PonnusamyIlayaraja Ponnusamy

Hi,
I'm also facing simillar issue while searching from pre chat page.
I'm searching the recod in the following ways.
1)            <input type="hidden" name="liveagent.prechat.findorcreate.map.doFind:Lead" value="Phone,true;" />
2)            <input type="hidden" name="liveagent.prechat.query:ContactPhone" value="Contact,Contact.Phone" />

I'm able to find a Contact whose phone# is exactly xxxxxxxxxx but it can't match numbers like:

xxx-xxx-xxxx

(xxx)  yyy - zzzz(multiple embedded blanks)

So, in case the phone number is not stored in correct format, the contact is not found even though the phone number is basically the same.

ShikibuShikibu
I suggest that you make another field, calculated, and have that field contain all the digits in the phone number, with spaces, hyphens, plus signs, parens, etc. removed. Call it, for instance, Standardized_Phone__c. For instance, if Phone contains "+1 (800) 555-1212", Standardized_Phone__c would contain "18005551212".

Then search on "Standardized_Phone__c Like '%5551212%".
Curran CurranCurran Curran
Hi dear, to be honest, I am unable to understand what you are talking about. I suggest checking cNumber's page (http://cnumber.co.uk/area-codes/0345/) to my relative to get 0345 number and area codes with a low cost for a connection. Because I a new on this forum and your question is crossing over my head. Can you please define it in simple and easy words. Thanks in advance
ShikibuShikibu
A formula field, something like this:
 
SUBSTITUTE(SUBSTITUTE(SUBSTITUTE( SUBSTITUTE(SUBSTITUTE( SUBSTITUTE 
(Phone, "(", ""), ")", ""), " ", ""), "-", ""), "+", "") ,".", "")