Details
-
Type: Improvement
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.21
-
Fix Version/s: 4.7.23
-
Component/s: CiviCase, CiviCRM API
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Core Team Contract
-
Verified?:No
Description
If you modify the "definition" of a CaseType, the new definition doesn't fully take effect until a new page-request. For example, in this snippet, the timeline entry does not appear on the newly created case.
addToTimeline('housing_support', array('name' => 'Case Task', 'reference_activity' => 'Open Case', 'reference_offset' => '9', 'reference_select' => 'newest'));
civicrm_api3('Case', 'create', array(...'housing_support'...));
function addToTimeline($caseType, $timelineEntry) {
$caseType = civicrm_api3('CaseType', 'getsingle', array('name' => $caseType));
foreach ($caseType['definition']['activitySets'] as &$actSet) {
if ($actSet['name'] === 'standard_timeline') {
$actSet['activityTypes'][] = $timelineEntry;
}
}
civicrm_api3('CaseType', 'create', array(
'id' => $caseType['id'],
'definition' => $caseType['definition'],
));
}