1

I am trying to access IsClosed(Checkbox) field value of Case Status in before insert trigger. But it's coming as blank. My requirement is to check the condition and then perform some action. Is there any way to access the value of this field in before insert trigger. Some Metadata API kind of thing.

Thanks

5

See Case IsClosed Trigger Bug?

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.

Sounds like the easiest approach may be to use an after trigger instead.

1
  • Rob's approved answer won't work. If you try it on AFTER trigger events you'll see the IsClosed field is not yet set either. Try querying for CaseStatus and cache it somewhere
    – Murilo
    May 19 '20 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.