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!

  • Use != instead of = Seller – Hemant Jain Nov 16 '17 at 14:40
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') )
)
| improve this answer | |
0

Try this:

AND( NewUser__r.Profile.Name = "Seller",
OR (
  ISPICKVAL(Style__c, 'Magazine'), 
  ISPICKVAL(Style__c, 'Digital'), 
  ISPICKVAL(Style_Type__c, 'Media') )
)
| improve this answer | |
  • 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! – Jones Stamp Nov 16 '17 at 14:31
  • please add some words to your solution. – Basti Nov 16 '17 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.