+ Start a Discussion
Nadia AyoubNadia Ayoub 

Lookup field filter based on running user

I have a lookup field that looks for contacts of a certain record type.  That part works fine. The problem is I want the filter to only apply to our sales reps. If an admin enters a value, I don't want that filter to apply. 

I see that I can make the field optional or required, but this is an all or nothing approach. I would be fine to make it optional for admins and required for sales reps but this is not possible.

So I tried to add in another filter critera for current user profile to only include admins, however this doesn't seem to work.  

Does anyone have recommendations for me to get around this?
Thanks!
Best Answer chosen by Nadia Ayoub
UC InnovationUC Innovation
So the reason why it's not working for you is because any user that is NOT Sys Admin will be able to see all records in the lookup field. This logic will apply to Account manager profiles as well, since they are NOT Sys admins. 

I thought what you wanted was for this filter to apply to Account managers, and for it to not apply to sys admins. If that's what you want you just need to change your logic to this:
 
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: Profile EQUAL TO Sales Rep)

OR

(Current User: Profile EQUAL TO System Administrator)

This also means that all other profiles besides sys admins and sales reps won't see any records. If you want all other profiles to see all records except Sales Rep, then use the logic of my previous post:
 
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: Profile EQUAL TO Sales Rep)

OR

(Current User: Profile NOT EQUAL TO Sales Rep)

Hope that makes sense!

All Answers

UC InnovationUC Innovation
Hi Nadia,

Could you post what your filter looks like? It sounds like you have the right approach.
Nadia AyoubNadia Ayoub
This is my filter criteria. The first two work as expected, it is only the current user filter that I'm having trouble with. It doesn't seem to be doing anything (fyi: my user alias is NadiaA)

(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: AliasNOT EQUAL TONadiaA)
UC InnovationUC Innovation
Hi Nadia,

Actually, by that logic any user that is not NadiaA will not see records. What you want is for sales reps to have a filter applied, and for all others to not have a filter. 

Try this logic:
 
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: AliasNOT EQUAL TONadiaA)

OR

(Current User: Alias EQUAL TONadiaA)

This means that if the current user is NOT NadiaA, the other 2 filters you specified will apply. If the current user is NadiaA, the other 2 filters you specified will not apply and nadiaA will see all records.
UC InnovationUC Innovation
Sorry I meant by your logic NadiaA will not see any records. All users that are not NadiaA will see records based on your other filter criteria.
UC InnovationUC Innovation
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: Profile EQUAL TO Sales Rep)

OR

(Current User: Profile NOT EQUAL TO Sales Rep)

Try this, it should work.
Nadia AyoubNadia Ayoub
Thanks for helping me out. Unfortunately when I changed the filter, it no longer works for either me or the sales rep. It lets both of us save the record.  

Here is what I changed it to: ((Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User Profile: NameEQUALSCustom - Account Manager)) OR (Current User Profile: NameNOT EQUAL TOCustom - System Adminstrator)
UC InnovationUC Innovation
So the reason why it's not working for you is because any user that is NOT Sys Admin will be able to see all records in the lookup field. This logic will apply to Account manager profiles as well, since they are NOT Sys admins. 

I thought what you wanted was for this filter to apply to Account managers, and for it to not apply to sys admins. If that's what you want you just need to change your logic to this:
 
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: Profile EQUAL TO Sales Rep)

OR

(Current User: Profile EQUAL TO System Administrator)

This also means that all other profiles besides sys admins and sales reps won't see any records. If you want all other profiles to see all records except Sales Rep, then use the logic of my previous post:
 
(Leadership Contact: Contact Record TypeEQUALSRegional Leadership) AND (Contact: Contact Record TypeNOT EQUAL TOBroker, Realtor) AND (Current User: Profile EQUAL TO Sales Rep)

OR

(Current User: Profile NOT EQUAL TO Sales Rep)

Hope that makes sense!
This was selected as the best answer
Nadia AyoubNadia Ayoub
Thanks, the second suggestion worked! I really appreciate all your help on this! 
UC InnovationUC Innovation
No problem, glad to be of help. Please don't forget to mark the best answer to mark this problem as solved!