While creating and configuring MOC objects, users are unable to locate text type fields to attach to their Phone fields in the field type drop-down.
The unavailability of text fields for phone Field selection during MOC configuration is not a bug but a conscious feature enhancement to optimize queries.
While performing an Incoming lookup on a phone field, we perform two activities. We do a query (SOQL) and a search (SOSL). A query will always require an exact match of the information as it cannot handle multiple formats. However, If the field type is phone we are assured of a result when we do a search. The SOSL will check for multiple things and will retrieve a result if the exact same digits are used in the search text. For example, we need to search for a number (321)7863456 and type 3217863456 in the phone field. While doing an SOQL we will not get any results as it does not match the format. However, results are retrieved while performing an SOSL search, as the search text though unformatted (missing the brackets or other special characters), contains the exact same set of digits as our required number. This is possible only because the search was run on a phone type field.
Conversely, if we use text type fields for InPhone MOC objects, instead of phone type fields, then, it affects the queries that we use for lookup resulting in the incoming SMS not being attached properly. For a text field, numbers stored as +1 432 432 9982 or 14324329982 or 1 43 24 32 99 82 all represent different values irrespective of whether they display matching digits or formats. Therefore, running a query or a search on these will not retrieve any results.
Though not recommended we do provide a workaround for customers who wish to use the text type fields despite its limitations.
Follow the given procedure to use a text field:
- Under All tabs click the message configuration object.
- Click the record (Object name) for which you would like to add a text field as a phone value.
- Click New Object Field Config button for Object Message Config.
- Type a name for the Object Field Config.
- Define Outgoing as the Field Purpose.
- Define API Name as the field type.
- Add the API name of the text field, that you would like to use in the Field Name field.
- Click Save.