1

Is there a way to determine within a validation rule whether a Case Status has changed from an Open picklist value to a Closed picklist without referencing every single picklist value?

I want to prevent closing a case from a validation rule but we have many different statuses. Similarly new statuses may be added in the future and I don't want to have to update the validation rule when a new one is created. The IsClosed field exists on case but is a case that only returns a true value AFTER later in the DML transaction.

The validation rule I'd like to write would look something like this

AND(
ISCHANGED(Status),
PRIORVALUE(An_Open_Value)
Status=A_Closed_Value
)

1 Answer 1

1

A possible solution would be to create a new (technical) checkbox on Case and create a RTF before flow to (un)check the new checkbox.

Tech design would be:

  • Create a new field on Case(checkbox, name "TEC Is Closed", don't show on any layout)
  • Create new Record Triggered Flow on Case, before insert/update
    • Use "Get" element to query CaseStatus object with filter "ApiName = Case.Status"
    • Use "Assignment" element to set TecIsClosed__c field equal to CaseStatus.IsClosed from the "Get" element
  • Create a new Validation Rule on Case to check if a Case was just closed:
AND(
  ISCHANGED(TecIsClosed__c),  // Check if the checkbox changed value
  TecIsClosed__c // Check that the checkbox is checked now
)

You must log in to answer this question.

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