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
HaydenMuhlHaydenMuhl 

Restricting search criteria

Is there a way to restrict searches of custom objects based on the value of a pick list or check box?

 

We have records that we mark as inactive that we would like to exclude from searches by default, but optionally include.

 

What is the best way to do this?

MarkSilberMarkSilber
You can't do this with the normal search functions since it is a text search not a parameter search. However, you could take advantage of the sharing rules to associate inactive records to a user in the role hierarchy that isn't visible to standard users. This would mean those records are completely hidden, not just from search, but when using views, reports, etc.
aririnaririn
I have a somewhat related question. For my opportunities, I created a custom field and when I do a search in opportunities for a value from that custom field, I get nothing. Does the search function only work for the opportunity name field? Is there a way around it?
MarkSilberMarkSilber
By default, the standard search will only search "key" fields in standard and custom objects, including the name field, phone number fields, etc. If you want to enable searching for a new custom field, you can make it an external key field. The other alternative is to use Advanced Search which will look through all fields. Neither solution looks at picklists by the way.