1

I am trying to fire a SOSL query in Apex to find phone number exits in Case module. Below is the example of one of the cases that I am trying to search.

enter image description here

I am using following query to search the record

FIND {503} IN ALL FIELDS RETURNING Case(ContactMobile,ContactPhone, CaseNumber where ( ContactMobile != null or ContactPhone!=null))

Even though there is a ContactMobile and ContactField exists in Case module it does not returning any row

enter image description here

However , if I search the same using SOQL then it returns the results

enter image description here

Both ContactMobile and ContactField are read only field and has the proper read only permission , not sure what is the problem here

enter image description here

1

You can't search all standard fields in Salesforce. Searchable Objects and Fields contains links to documents that state which standard fields are searchable in Lightning and Classic. Note that Contact Mobile and Contact Phone are not searchable fields. These act as a type of "formula" field, and fields that don't actually store a value can't be searched. One possible solution would be to create a custom field and copy the values to the custom field via trigger or Process Builder so that they become indexed and searchable.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.