SuiteCRM Search for phone numbers is not working correct

Hi, we are using SuiteCRM Version 7.10.7
and if you are using the search to lookup a phone number (reverse search the number)
you only get results if you are searching for the number exactly as it is written in the database.
So, phone work in data record is like: +43 650-222333-11
You have to search for 650-222333-11
65022233311 does not work
222333 does not work
4365022233311 does not work… and so on…

Is there any solution for this?

Thanks

1 Like

Hi
Have a look on this product!
https://store.outrightcrm.com/product/outrightcrm-global-search/#

It should work as expected!

I hope that this is not the final answer to the issue.
I cant believe no one else having this kind of problem - everyone uses phone numbers in an CRM?!
But no one reverse-search for a phone number?

Most of searches works on exact search or Like ( Matching ) search.

Searching on phone number does not fall on any both of them. as Phone having formatting characters between it.

Yes but you just have to clean the characters out before doing the query.
In theory i know what to do, just not what in crm.

Is there any trial of your product?

There is no trial on my product.
But if you don’t like or it does not work. You can ask for refund.

For anyone who also has this issue, I got an solution coded now.

You can add for example to your contacts advanced search a new field “all phone numbers” which goes through the fields you define.

File:
custom\modules\Contacts\metadata\SearchFields.php

add:

   'phone_all_numbers' =>
  array (
    'query_type' => 'format',
 'operator' => 'subquery',
            'subquery' => array(
                'SELECT id FROM contacts WHERE phone_work LIKE  "%"',
                'SELECT id FROM contacts WHERE REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( phone_work,  "+",  "" ) ,  "-",  "" ) ,  "(",  "" ) ,  ")",  "" ) ,  " ",  "" ) LIKE  "%"',
                'SELECT id FROM contacts WHERE phone_mobile LIKE  "%"',
                'SELECT id FROM contacts WHERE REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( phone_mobile,  "+",  "" ) ,  "-",  "" ) ,  "(",  "" ) ,  ")",  "" ) ,  " ",  "" ) LIKE  "%"',
                'OR' =>true
                ),
 'db_field'=>array('id'),
 'vname' => 'LBL_OFFICE_PHONE',
  ),

and in file:
custom\modules\contacts\metadata\searchdefs.php add:

        'phone_all_numbers' => array(
            'name' => 'phone_all_numbers',
            'label' => 'PHONE NUMBER SEARCH',
            'type' => 'name',
            'width' => '40%'
        ),

Now you get a new field in the advanced search for Contacts which goes through phone_work and phone_mobile fields in contact,
and ignores all characters in the phone fields.

What I now need, is that this also works in the global search.
Maybe someone can give me a hint how to get this going.

1 Like

add this line to defs

‘force_unifiedsearch’=>true

Have a repair , it must started including in Global Search.

so you mean:

'phone_all_numbers' => array(
            'name' => 'phone_all_numbers',
            'label' => 'PHONE NUMBER SEARCH',
            'type' => 'name',
          'force_unifiedsearch'=>true,
            'width' => '40%'
        ),

i repaired, but sadly it is not working. what you mean with “it must started including in global search”?

1 Like

You need to add this on SearchFields.php.

1 Like

Thank you! This works perfectly!

Thanks @xanthos84 and @ashish for sharing a solution to an otherwise ignored need.
For this to work, does the field ‘type’ need to be ‘Phone’ or will this work with ‘TextField’?

Also, I cannot seem to find anywhere what is the benefit or purpose of using ‘Phone’ field type - any reference I can read?

I think only phone fields will have the click-to-call feature (requires phone dialing software installed no your PC). See the checkbox in Admin / System Settings.

Also, the fact that it’s there as a separate field type facilitates code customization (which people often do to accommodate some peculiarity of their national format).

Would it be nice to have this in the standard so that everyone could benefit from it?

2 Likes

Thanks for help, this is great for finding any numbers in phone fields.

Just for cosmetics: For multilingual labels:

  1. Change label to ‘LBL_PHONE_NUMBER_SEARCH’ in searchdefs.php

  2. create two files in custom/Extension/modules/Contacts/Ext/Language as en_us.PhoneNumberSearch.php and de_DE.AdvancedPhoneNumberSearch.php

  3. Put following to DE and EN files

    <?php $mod_strings['LBL_PHONE_NUMBER_SEARCH'] = 'Erweiterte Suche nach Tel.'; <?php $mod_strings['LBL_PHONE_NUMBER_SEARCH'] = 'Advanced Phone Search';
  4. QR & R

1 Like