function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The NewbieThe Newbie 

Need help with few validation rules

Hi everyone,

I need help with the few validation rule where 
1. Rejected__c <= Inspected__c <= Received__c
    But Inspected__c and Received__c fields can be empty
2. Case Status cant be changed to closed earlier than the dates below
    Container_date__c, Correction_date__c,Prevention_date__c
3.Case status can only be changed to Close from Montioring
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi,

Can provide more details on 1st question?

Thanks!!
The NewbieThe Newbie
@Ankaiah
It is a case object where i have three fields as mentioned above 
All the fields on the 1st question is Number data type
AnkaiahAnkaiah (Salesforce Developers) 
Hi ,

try with below for 2 & 3 questions.
2. Case Status cant be changed to closed earlier than the dates below Container_date__c, Correction_date__c,Prevention_date__c


AND(ISCHANGED(status), 
OR(CloseDate < Container_date__c,
   CloseDate < Correction_date__c, 
   CloseDate < Prevention_date__c),
ISPICKVAL(Status,'closed'))
3.Case status can only be changed to Close from Montioring.
AND(ISCHANGED(status), 
NOT( ( ISPICKVAL(PRIORVALUE(status), 'Montioring'))),
ISPICKVAL(Status,'closed'))

Still i am not clrear on 1st question. when the validation rule should fire.

Thanks!!
 
The NewbieThe Newbie
@Ankaiah 
it should fire when the case status is closed or monitoring then we have set this condition 
AnkaiahAnkaiah (Salesforce Developers) 
Hi 

try with below rules.

1. Rejected__c <= Inspected__c <= Received__c
    But Inspected__c and Received__c fields can be empty
AND(ISCHANGED(status), 
OR(Rejected__c <= Inspected__c,
   Rejected__c <= Received__c),
AND(NOT(ISNULL(Inspected__c)),NOT(ISNULL(Inspected__c))),
ISPICKVAL(Status,'closed'))

2. Case Status cant be changed to closed earlier than the dates below
    Container_date__c, Correction_date__c,Prevention_date__c
AND(ISCHANGED(status), 
OR(CloseDate < Container_date__c,
   CloseDate < Correction_date__c, 
   CloseDate < Prevention_date__c),
ISPICKVAL(Status,'closed'))
3.Case status can only be changed to Close from Montioring.
 
AND(ISCHANGED(status), 
NOT( ( ISPICKVAL(PRIORVALUE(status), 'Montioring'))),
ISPICKVAL(Status,'closed'))

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​