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

Custom search issue: Data not available message

We have a custom search page built on VF and a controller class (without sharing). Custom search is for search on Cases. We have defined sharing rules on Case based on some criteria around case.

Also for the case view and edit page are overridden with VF page.

In the custom search page, if a User searches for Case#, even if the users does not have the read access, (as we are using running as "without sharing" the record should be returned- this is designed as per the business requirement), the case record will be displayed in the results, but when the users click the record, the user is getting the below message:

**Data Not Available
The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.** 

We are expecting a error message: where Salesforce would say:
Insufficient privilege message.

As we are overridden the Case view page with VF page , we are getting Data not available message, but we use the standard Case view page, then we are getting the "Insufficient privilege message.".

Can anyone please provide suggestions on how to make Salesforce display standard message ""Insufficient privilege message. etc..." instead of "Data not available" page when using the VF page for Case view page.