Answers.Body: <p>CiviCase was originally designed with HIPPA and related requirements in mind, so it tracks changes.</p>
  
  <p>You could have your code delete the original after making a new one.</p>
  
  <p>You can also turn on advanced logging under admin - system settings - misc. I believe a future goal is to have that logging system, based on triggers, completely replace revisions. I'm not sure if it completely does that yet.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-03T15:31:51.213Z
Answers.Text: I see. Thank you. We also have logging enabled, so I think we'll have to delete the original. Could the deletion be done using a chained api function from the update function, or is that too much to hope for?
Answers.UserDisplayName: Jern
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-03T15:59:22.123Z
Answers.Text: I don't think so since it wouldn't be a standard operation. And actually if the delete api call is too smart it might not actually delete it just set is_deleted since it's a case activity. But if it actually deletes it then you'd also want to set original_id to null on the new one too.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-03T14:29:02.473Z
Answers.LastActivityDate: 2019-03-03T14:29:02.473Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>There is also a setting which AFAIK prevents adding a new revision. The setting is under <strong>Administer>System Settings>CiviCase>CiviCase Settings</strong> and is called <strong>Enable Embedded Activity Revisions</strong></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-05T11:14:19.500Z
Answers.Text: Brilliant. That's exactly what I needed. Thank you!
Answers.UserDisplayName: Jern
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-05T07:57:33.700Z
Answers.LastActivityDate: 2019-03-05T07:57:33.700Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>With case activities, the Activity Create API seems to create a new revision of the activity. Is there a way of using the API to update a case activity without adding a new revision?</p>
  
  <p>My code currently looks like this:</p>
  
  <pre><code>   foreach ($acts as $act) {
       $result = civicrm_api3('Activity', 'create', [
        'return' =&gt; ["contact_id", "subject"],
        'id' =&gt; $act['id'],
            'custom_114' =&gt; $var1,
            'custom_115' =&gt; $var2,
       ]);
     }
  </code></pre>
  
  <p>I just want to overwrite the contents of custom_114 and custom_115 in each existing activity record, but it seems to create a new revision of each activity, containing the updated values.</p>
  
  <p>API v3<br/>
  CiviCRM v. 5.10.4<br/>
  Joomla</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-11T08:40:00.180Z
Comments.Text: You could look at the custom value API perhaps? I'd be tempted just to SQL it, if you know what you're doing and are happy that there will be no side effects.
Comments.UserDisplayName: artfulrobot
Tags: <api><civicase><activities>
Title: Updating a Case Activity using API
ThreadText: # Updating a Case Activity using API
  
  (Asked by: username_0 on 2019-03-03)
  
  With case activities, the Activity Create API seems to create a new revision of the activity. Is there a way of using the API to update a case activity without adding a new revision?
  My code currently looks like this:
     foreach ($acts as $act) {
       $result = civicrm_api3('Activity', 'create', [
        'return' => ["contact_id", "subject"],
        'id' => $act['id'],
            'custom_114' => $var1,
            'custom_115' => $var2,
       ]);
     }
  
  I just want to overwrite the contents of custom_114 and custom_115 in each existing activity record, but it seems to create a new revision of each activity, containing the updated values.
  API v3
  CiviCRM v. 5.10.4
  Joomla
  
  **Tags:** api, civicase, activities
  
  > **Comments:**
  > **username_1**: You could look at the custom value API perhaps? I'd be tempted just to SQL it, if you know what you're doing and are happy that there will be no side effects.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2019-03-05. Score: 3 | Accepted answer
  
  There is also a setting which AFAIK prevents adding a new revision. The setting is under **Administer>System Settings>CiviCase>CiviCase Settings** and is called **Enable Embedded Activity Revisions**
  
  > **Comments:**
  > **username_0**: Brilliant. That's exactly what I needed. Thank you!  
  
  ---
  
  ### Answer by username_2 on 2019-03-03. Score: 1
  
  CiviCase was originally designed with HIPPA and related requirements in mind, so it tracks changes.
  
  You could have your code delete the original after making a new one.
  
  You can also turn on advanced logging under admin - system settings - misc. I believe a future goal is to have that logging system, based on triggers, completely replace revisions. I'm not sure if it completely does that yet.
  
  > **Comments:**
  > **username_0**: I see. Thank you. We also have logging enabled, so I think we'll have to delete the original. Could the deletion be done using a chained api function from the update function, or is that too much to hope for?  
  > **username_2**: I don't think so since it wouldn't be a standard operation. And actually if the delete api call is too smart it might not actually delete it just set is_deleted since it's a case activity. But if it actually deletes it then you'd also want to set original_id to null on the new one too.  
  
  ---
  
  