0

I'm usually pretty great at writing validation rules but guess this Monday isn't off to a great start. I'm trying to write one with the below criteria and I'm not getting anywhere.

Any help would be greatly appreciated!

1) All profiles except 2.

2) Certain Record Types

3) Status__c can only be changed if current status is "Status A".

4) Status__c can only be changed to "Status B".

This seems to be working with the exception of when I change a record from "Status A" to "Status B". It is not letting the user change the status to anything after its created which it has a null value after creation which is good, since I only want the user to be able to change the status when the current status of the record is "Status A" and I only want them to be able to change the status to "Status B". Any ideas?

AND( 
    $Profile.Name <> 'Custom', 
    $Profile.Name <> 'System Administrator', 
    CONTAINS(RecordType.Name , "Custom"), 
    NOT(ISNEW()), 
    OR( 
        NOT(ISPICKVAL(PRIORVALUE(Status__c), "Status A")) 
        , 
        AND( 
            ISCHANGED(Status__c), 
            ISPICKVAL(PRIORVALUE(Status__c), "Status A"), 
            NOT(ISPICKVAL(Status__c, "Status B")) 
        ) 
    ) 
)
2
  • This is confusing. You state you only want the status to be able to be changed if its Status A, then you state your issue occurs when you try to change a status from Status B? Jul 18, 2017 at 0:23
  • How is it confusing? Not all profiles are included in this validation rule.
    – john
    Jul 18, 2017 at 4:22

1 Answer 1

0

Can you try this:

AND(
     $Profile.Name <> 'Custom', 
     $Profile.Name <> 'System Administrator', 
     CONTAINS(RecordType.Name , "Custom") ,
     NOT(ISNEW()),
     NOT(ISCHANGED(Status__c) 
        && ISPICKVAL(PRIORVALUE(Status__c), "Status A") 
        &&  ISPICKVAL(Status__c, "Status B")    
    ) 
}

You must log in to answer this question.

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