The Problem
When searching phone number fields in Infor CRM 10, you may encounter an issue where the Starts With operator fails to return records that appear to match the entered phone number.
This can occur when phone numbers stored in the database contain formatting characters such as parentheses, spaces, and hyphens.
Consider a contact with the following phone number:
(217) 555-1234
When a user searches the phone number field using Starts With and enters (217), the contact is not returned. However, searching the same field using Contains with 217 successfully finds the record.
Using SQL Server Profiler, we observed that Infor CRM removes parentheses from the search value before executing the query. A Starts With search produces a SQL condition equivalent to:
WHERE PHONE LIKE '217%'
Because the stored value begins with an opening parenthesis, the condition does not match. By comparison, Contains produces:
WHERE PHONE LIKE '%217%'
This returns the record because the digits occur within the stored value.
Why Does This Happen?
Infor CRM 10 uses phone number controls that can display formatted phone numbers while storing newly entered values without those formatting characters.
For example, a phone number displayed as (217) 555-1234 may actually be stored as 2175551234.
However, databases upgraded from earlier versions may contain phone numbers stored with formatting characters. Formatted values may also have originated from imports or external integrations.
When the application removes formatting from the search value but the stored data retains that formatting, the comparison becomes inconsistent.
Infor’s Recommended Resolution
After reporting this behavior to Infor Support, their recommendation was to remove special characters from phone numbers stored in the database.
This brings existing values into alignment with how Infor CRM 10 stores newly entered phone numbers. However, care should be taken when cleaning up phone number data.
International numbers may contain a leading +, and phone numbers with extensions may contain an x followed by extension digits. The goal should be to normalize only values matching a known formatting pattern.
Identifying Formatted Phone Numbers
For standard US phone numbers, we can identify values stored in the format (###) ###-#### using SQL Server’s LIKE operator:
SELECT CONTACTID, WORKPHONE
FROM sysdba.CONTACT
WHERE WORKPHONE LIKE
'([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
AND LEN(WORKPHONE) = 14;
This identifies values matching the expected format. The length check excludes most numbers with extensions or other trailing characters, although SQL Server’s LEN() ignores trailing spaces.
Previewing the Normalized Values
Before updating the database, preview how the numbers would look after removing formatting:
SELECT
CONTACTID,
WORKPHONE AS OriginalPhone,
SUBSTRING(WORKPHONE, 2, 3) +
SUBSTRING(WORKPHONE, 7, 3) +
SUBSTRING(WORKPHONE, 11, 4) AS CleanedPhone
FROM sysdba.CONTACT
WHERE WORKPHONE LIKE
'([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
AND LEN(WORKPHONE) = 14;
| Original Phone | Cleaned Phone |
|---|---|
| (217) 555-1234 | 2175551234 |
| (312) 555-9876 | 3125559876 |
| (800) 555-1234 | 8005551234 |
What About Phone Numbers with Extensions?
Some phone number fields may contain extensions, such as (217) 555-1234x123. The normalized value should be 2175551234x123.
A cleanup script should validate the extension and preserve it while removing formatting from the main number. Avoid indiscriminately removing all nonnumeric characters, since that could alter international numbers or remove meaningful extension information.
Finding Other Phone Number Fields
Infor CRM stores phone numbers in multiple tables and columns, including Account, Contact, Lead, Activity, and custom tables.
SQL Server metadata can help identify candidate fields:
SELECT
s.name AS SchemaName,
t.name AS TableName,
c.name AS ColumnName,
ty.name AS DataType,
c.max_length AS MaxLength
FROM sys.tables t
INNER JOIN sys.schemas s
ON t.schema_id = s.schema_id
INNER JOIN sys.columns c
ON t.object_id = c.object_id
INNER JOIN sys.types ty
ON c.user_type_id = ty.user_type_id
WHERE
(
c.name LIKE '%PHONE%'
OR c.name LIKE '%FAX%'
OR c.name LIKE '%MOBILE%'
OR c.name LIKE '%PAGER%'
)
AND ty.name IN ('varchar', 'nvarchar', 'char', 'nchar')
AND (
c.max_length = -1
OR CASE
WHEN ty.name IN ('nvarchar', 'nchar')
THEN c.max_length / 2
ELSE c.max_length
END >= 14
)
ORDER BY
s.name,
t.name,
c.name;
This returns potential phone number fields, including custom fields, while excluding many checkbox and short-text fields. The results can serve as the basis for a database-wide assessment.
Recommendations Before Updating
- Back up the database and test in a nonproduction environment.
- Identify affected fields and determine which need to be updated.
- Validate formatting patterns before modifying values.
- Preserve extensions and meaningful international dialing characters.
- Review integrations or synchronization processes that might reintroduce formatting.
- Test Starts With searches after normalization.
Direct SQL updates may bypass application-level business logic. Review any triggers, integrations, or dependent processes before proceeding.
Conclusion
If the Starts With operator in Infor CRM 10 isn’t returning expected phone number matches, check how those values are stored in SQL Server.
The problem may be a difference between the formatting of existing stored numbers and the normalized search values generated by the application.
Infor’s recommended approach is to remove legacy formatting characters from stored phone numbers. A carefully targeted cleanup can restore expected search behavior without unnecessarily modifying international numbers, extensions, or other data.
In the meantime, using the Contains operator can provide a practical workaround.



