anyone have a working model of this. we thought about drupal/civi rules but may just add in an extension.

seems to us that it could be quite a generic solution, after all, when a Case is Closed you don't want to keep finding Activities that may be eg Scheduled

  • If you mean the autopopulated ones from the timeline when the activities first get added (database field is_auto=1), that sounds familiar but I think it was decided not to. In any case (pun) it seems like a useful thing. Only thing I can think is that if you're auditing cases for "completion percentage" or something like that and want to be able to tell them apart from actual cancelled, then might want to use a configurable custom status.
    – Demerit
    Apr 10, 2019 at 4:44
  • our plan would be to set them to a Status that is different than Completed, eg Cancelled or something that would help differentiate. and no we aren't using a timeline.
    – petednz - fuzion
    Apr 11, 2019 at 7:01
  • Similarly for inactive cases. At present, scheduled reminders are still send out, even if a case has been marked as inactive. Not sure how to handle this. It would be possible to change the status of all the uncompleted case activities, but then again I can imaging needing to reactivate a case with all the activity status information unaltered.
    – Jern
    Apr 30, 2019 at 10:40

1 Answer 1


I would hook on https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post/ to find cases being closed then do the work from there. I would follow the civicrm_option_value grouping field to determine if a status represents closed.

This seems like an opportunity for a nice small single purpose extension. Maybe 3-4h to develop and publish.

  • 1
    That would only catch cases closed via UI, so it might need a little more, like hookPost.
    – Demerit
    Apr 16, 2019 at 18:30
  • Another note: I don't know how many people are using this feature but you can have more than one case status that represents closed. It's not the "resolved/closed" case status itself that determines closed it's the grouping field in civicrm_option_value that is actually used to determine which case statuses represent closed. A use-case would be something like if you wanted to capture closure reasons, e.g. "Closed-claim approved" vs "Closed-claim denied".
    – Demerit
    Apr 16, 2019 at 21:49
  • He Demerit - yep we are aware of the setting that specifies if a Status means closed/resolved, though seems that is purely in the code eg for Searches and not in the db as a value
    – petednz - fuzion
    Apr 16, 2019 at 22:28
  • I mean if you look in CRM/Case/Form/Activity/ChangeCaseStatus.php in endPostProcess(), the check for closed vs. open is against the grouping field in civicrm_option_value for the case status that was selected on the form, not against the status value itself, e.g. if you select Urgent, it checks to see what the grouping field for Urgent has in civicrm_option_value.
    – Demerit
    Apr 16, 2019 at 23:13
  • $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value');
    – Demerit
    Apr 16, 2019 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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