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
VRKVRK 

Required help on Validation Rule

Hi Folks,
pls find below my requirement :

i have 2 case status ( Review & Approval )
When i try to change case status as ' Review ' it must through validation rule as ""  must complete approval status

Below is my code :
AND(
ISPICKVAL( Status , "Review"),
NOT
(ISPICKVAL(PRIORVALUE(Status),"Approval"))
)

When i try to change Review status , it is througing Error .
When i change status as approval and then i will try to change "Review " status getting below error :
This error occurred when the flow tried to update records: FIELD_CUSTOM_VALIDATION_EXCEPTION: 00179699 ,

Any help how to fix this ...Thanks
Khan AnasKhan Anas (Salesforce Developers) 
Hi Sekhar,

Greetings to you!

Please use below validation rule:
Cannot skip the sequence:
CASE( Status__c , 
"Approval",1, 
"Review",2,0) 
> 
CASE( PRIORVALUE(Status__c) , 
"Approval",1, 
"Review",2,0) + 1

Cannot skip the sequence and cannot go backward:
CASE( Status__c , 
"Approval",1, 
"Review",2,0) 
<> 
CASE( PRIORVALUE(Status__c) , 
"Approval",1, 
"Review",2,0) + 1

Also, please check the other validation rules on that object.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
VRKVRK
Thanks for your prompt response..
But here there is no sequence...
We have more than 10 status values..
Both Approval & Review are not in orders .....
my requirement , after approval status completed then only go for Review status ...
 
Ravindra Kashyap 7Ravindra Kashyap 7
Hello Sekhar,

In my case I have case status like Working, Escalated, Completed and Review.

When 1. Working->Review => Throw error.
           2. Working->Completed->Review => Saved 
           3. Completed->Review => Saved 
IF(ISPICKVAL( Status ,"Review" ),IF(ISPICKVAL(PRIORVALUE(Status ),"Completed" ), False, True) , False)
Please try above formula and let me know if it is working as expected or not.

Hope it will help you to solve your problem 😊
Regards,
Ravindra Nath Kashyap
VRKVRK
Hi Ravindra...Thanks for your prompt response.

When i try to update i am getting below error :
 This error occurred when the flow tried to update records: FIELD_CUSTOM_VALIDATION_EXCEPTION

I verified, these is process builder and updating Case status "Review "immediate action:
Process builder :
Critiria : Case status equcals to Review 
Immediate actions:
initial_review_date  formula Today()

Result
Failed to update records that meet the filter criteria
So, Do you have any idea, how can we can we over come this problem / fix it
Ravindra Kashyap 7Ravindra Kashyap 7
Hi Sekhar,
Try to put some more entry criteria to avoid this scenario, I am exactly not sure why you are getting this error :(