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
Saswat619Saswat619 

Salesforce Lookup Filter criteria

When you have a Lookup Relationship with defined Filter Criteria, you cannot provide a Profile or User with the option to override or neglect this Relationship. If you are using active Integration or you want to perform an initial Data Load for which this Filter Criteria needs to be bypassed, your upload will fail for certain cases. Because the active user doesn't fulfill the criteria defined.

For a User record who performs the Data Migration or Integration, this might become a problem.

Could you please help on this matter as atleast system admin should be able to update the data by ignoring the criteria? Also, remember even if the validation rule is another option,the user will again see lots of unwanted data in lookup filter.
Andy BoettcherAndy Boettcher
You could always do a non-mandatory lookup filter.  The users will have the option to clear the filter themselves, but you will be able to do what you're looking for and the users will have the filter applied when they do the initial lookup and searches...
Xavier MuñozXavier Muñoz
Another option is to create a checkbox custom field on user (e.g. bypassFilter__c), and add a condition to the filter criteria (AND $User.bypassFilter__c = false).
Then you can update the check to true for the users who perform the migrations and bypass the filters.
The only thing is that to be honest, I don't know what would happen if a user with the check = false tries to edit the record bypassed, or opens the lookup window, would be interesting to test.
Joshua MoodyJoshua Moody
This can be accomplished using the lookup filter.  Add the filters you need to apply to everyone else first.  For the last filter, use either Current User > Alias for a single user or Current User Profile>Name for a group and "equals" Value "Alias or Profile Name".  Now your filters are right, but you need to adjust the filter logic.

If you have used any of the of the filter logic at the bottom, put parenthesis around all of them.  If you have not, you will to add "(1-N)" where N is the number of filters not counting the last one.  Then add "OR X" where X is the last filter.  It would look something like this:

User-added image
This means for everyone, one or two is required, and three is required unless four is true.  So four being true bypasses the rest.  Happy Coding!