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

Case IsClosed Trigger Bug?

I was testing out some before and after triggers on cases.  When a case goes from a status that is not closed to a status that is closed it will not reflect this change in the trigger.  Basically Trigger.old.IsClosed will equal false (which would be correct) and is false as well (which I feel is incorrect).  I would expect that if the new status is a one that is a closed status would be true.
Any thoughts?
This is not a bug. Currently the setting of this value is not done until the save which comes after the before trigger in the event timeline.

There are two workarounds available for you I believe:

1) Execute your logic in an after trigger. This occurs after the save and thus the value should be set.
2) Query CaseStatus with the value provided by the user for the status to determine if it is flagged as a closed status.

Which one you take would depend on whether you need to modify the object in any way since this is allowed in before triggers but not in after triggers.

Thanks I'll try suggestion #2, I should note however that was experiencing the same thing when using the after trigger so I do not believe suggestion #1 will work.

This trigger seems to behave as expected (no error):

trigger caseTriggerTestAfter on Case(after update) {
    if( == 'Closed' && !'not closed!');


Whereas this one does return the expected "error":

trigger caseTriggerTestAfter on Case(after insert, after update) {
    if( == 'Closed' &&'closed!');


Is the above not consistent with the behavior you are seeing?