I am writing a validation rule to add a error message on case close page, if user trying to change the case status to resolved for the already resolved cases then it should through an error stating that you can not resolve the case that already resolved. I have written the below logic :
IF( AND ( OR( ISPICKVAL(PRIORVALUE(Status),'Resolved'), ISPICKVAL(PRIORVALUE(Status),'Resolved - Redirected'), ISPICKVAL(PRIORVALUE(Status),'Resolved – Duplicate/Invalid') ) , OR( ISPICKVAL(Status,'Resolved'), ISPICKVAL(Status,'Resolved - Redirected'), ISPICKVAL(Status,'Resolved – Duplicate/Invalid') ) ),TRUE,FALSE )
But, when i am trying to close the case for the first time also system is throughing the below error:::
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger CaseEventActions caused an unexpected exception, contact your administrator: CaseEventActions: execution of AfterUpdate caused by: System.DmlException: Upsert failed. First exception on row 0 with id a0Dq0000008ulxMEAQ; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You cannot resolve the case that is already resolved. Please reopen the case to edit.:
[Status]: Class.StatusHistoryHelper.statusHistoryByStatus: line 94, column 1