0

I am trying to write a Validation Rule that says:

If a Picklist has specific values selected, then a lookup field named "New User" on the same page must be only allowed to select a User from the lookup with a certain profile type, or there would be an error shown. Here is what I have done so far and it is not working:

AND(
NewUser__c $Profile.Name = "Seller",
OR(
ISPICKVAL(Style__c, 'Magazine'),
ISPICKVAL(Style__c, 'Digital'),
ISPICKVAL(Style_Type__c, 'Media')
)
)

I think the AND statement is completely wrong. I'm stuck. Any and all help is appreciated. Thanks!

1
  • Use != instead of = Seller Commented Nov 16, 2017 at 14:40

2 Answers 2

1

So, your requirement is, whenever the lookup field has any other user apart from Seller profile user, and the picklist is any of the 3 values, you need to throw a error.

So basically, validation rule will throw a error if, the condition evaluates to true.

You need to check if the profile is != Seller And If the picklist is any of the three values.

So in this case below code should work.

Try this:

AND( NewUser__r.Profile.Name != "Seller",
OR (
  ISPICKVAL(Style__c, 'Magazine'), 
  ISPICKVAL(Style__c, 'Digital'), 
  ISPICKVAL(Style_Type__c, 'Media') )
)
0

Try this:

AND( NewUser__r.Profile.Name = "Seller",
OR (
  ISPICKVAL(Style__c, 'Magazine'), 
  ISPICKVAL(Style__c, 'Digital'), 
  ISPICKVAL(Style_Type__c, 'Media') )
)
2
  • Hey, I tried this but now it will only throw an error when I choose a "Seller" Profile. I need to it throw an error when anyone who does not have the "Seller" profile is chosen. Thanks! Commented Nov 16, 2017 at 14:31
  • please add some words to your solution.
    – itsmebasti
    Commented Nov 16, 2017 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .