1

I have the following validation rule:

AND(   
$Profile.Name <> 'System Administrator',  
OR(  
ISPICKVAL(CustomerRun__c, "Class 1"),  
ISPICKVAL(CustomerRun__c, "Class 2")  
)  
)

Basically what I want to do is to make the Record read only (except for System Admin) when CustomerRun__c is either set to Class 1 or to Class 2.

I can't see what's wrong with my validation rule. Tia, Lily

  • 1
    It is working fine. what issue are you seeing ? – Himanshu Jun 2 '16 at 6:44
  • The issue is when I want to set CustomerRun__c from Class 3 to Class 2, the validation rule triggers, which it shouldn't. – Lily Jun 2 '16 at 6:50
  • @Lily ten what you want ? – Ratan Paul Jun 2 '16 at 7:03
  • When Class 1 or Class 2 are selected, I want the validation rule to trigger. – Lily Jun 2 '16 at 7:13
4

Try this:

AND( 
$Profile.Name <> 'System Administrator', 
OR( 
ISPICKVAL(PRIORVALUE(CustomerRun__c), "Class 1"), 
ISPICKVAL(PRIORVALUE(CustomerRun__c), "Class 2") 
) 
)

your validation rule is preventing Record to be saved with those values, but you need to prevent it from moving away from them.

EDIT changed rule a little, now should be fine. tested, it works.

| improve this answer | |
0
If( TEXT(CustomerRun__c) =='Class 1' || TEXT(CustomerRun__c) =='Class 2',$Profile.Name <> 'System Administrator',false)
| improve this answer | |

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.