Answers.Body: <p>It would be a dopey workaround but you could have a task at the end of the sequence that's a dummy task, and just don't complete it. Or create a new <em>activity</em> status that means completed to you but isn't the same as the core completed.</p>
  <p>If you're up for writing a small extension you can implement <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_container/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_container/</a> and what you can do is undo this: <a href="https://github.com/civicrm/civicrm-core/blob/f27b812e4dd51307422bd812918aa4afce1515fa/Civi/Core/Container.php#L406" rel="nofollow noreferrer">https://github.com/civicrm/civicrm-core/blob/f27b812e4dd51307422bd812918aa4afce1515fa/Civi/Core/Container.php#L406</a></p>
  <p><code>$dispatcher-&gt;addListener('hook_civicrm_caseChange', ['\Civi\CCase\SequenceListener', 'onCaseChange_static']);</code></p>
  <p>So in your hook do something like</p>
  <p><code>\Civi::dispatcher()-&gt;removeListener('hook_civicrm_caseChange', ['\Civi\CCase\SequenceListener', 'onCaseChange_static']);</code></p>
  <p>Note that also undoes the other things the sequencelistener does, so you could instead theoretically do something like implement <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseChange/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseChange/</a> where you change the case status back to Ongoing.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-24T00:26:27.990Z
Answers.LastActivityDate: 2021-09-24T17:02:54.783Z
Answers.LastEditDate: 2021-09-24T17:02:54.783Z
Answers.UserDisplayName: Demerit
Body: <p>We have Case Types that only use sequences. For these cases, once we mark the last activity in the sequence to Completed, the Case automatically gets set to Resolved (even if Resolved is not an enabled status for the case, which is a separate issue).</p>
  <p>Is there a way to disable this automated change of status when the sequence is complete? Any way we can modify that behavior per Case Type? If not through a GUI, any hook I should look into?</p>
  
Tags: <civicase>
Title: CiviCase: Don't Change Status to Resolved on Final Activity of a Sequence?
ThreadText: # CiviCase: Don't Change Status to Resolved on Final Activity of a Sequence?
  
  (Asked by: username_0 on 2021-09-23)
  
  We have Case Types that only use sequences. For these cases, once we mark the last activity in the sequence to Completed, the Case automatically gets set to Resolved (even if Resolved is not an enabled status for the case, which is a separate issue).
  
  Is there a way to disable this automated change of status when the sequence is complete? Any way we can modify that behavior per Case Type? If not through a GUI, any hook I should look into?
  
  **Tags:** civicase
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-24. Score: 1 | Accepted answer
  
  It would be a dopey workaround but you could have a task at the end of the sequence that's a dummy task, and just don't complete it. Or create a new *activity* status that means completed to you but isn't the same as the core completed.
  
  If you're up for writing a small extension you can implement <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_container/> and what you can do is undo this: <https://github.com/civicrm/civicrm-core/blob/f27b812e4dd51307422bd812918aa4afce1515fa/Civi/Core/Container.php#L406>
  
  `$dispatcher->addListener('hook_civicrm_caseChange', ['\Civi\CCase\SequenceListener', 'onCaseChange_static']);`
  
  So in your hook do something like
  
  `\Civi::dispatcher()->removeListener('hook_civicrm_caseChange', ['\Civi\CCase\SequenceListener', 'onCaseChange_static']);`
  
  Note that also undoes the other things the sequencelistener does, so you could instead theoretically do something like implement <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_caseChange/> where you change the case status back to Ongoing.
  
  
  ---
  
  