Answers.Body: <p>It's not an &quot;api&quot; exactly, but you can use:</p>
  <pre><code>      $caseParams = [
          'activity_id' =&gt; 1234,
          'case_id' =&gt; 12,
        ];
        CRM_Case_BAO_Case::processCaseActivity($caseParams);
  </code></pre>
  <p>Are you saying the api call used to work before and now is failing? I'm not sure if it ever worked before with an existing activity?</p>
  <p>It looks also like in api4 you can do:</p>
  <pre><code>\Civi\Api4\CaseActivity::create()
    -&gt;addValue('activity_id', 1234)
    -&gt;addValue('case_id', 12)
    -&gt;execute();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T12:03:49.443Z
Answers.Text: Thanks @Demerit, I'll edit and clarify my post.
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T12:26:01.677Z
Answers.Text: Would CRM_Case_BAO_Case::processCaseActivity($caseParams) inside a drupal module work after bootstrapping civicrm?
Answers.UserDisplayName: nielo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T12:52:31.127Z
Answers.Text: Yes I've used it that way before (in drupal 7 at least).
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-24T11:05:24.057Z
Answers.LastActivityDate: 2021-08-24T11:17:24.470Z
Answers.LastEditDate: 2021-08-24T11:17:24.470Z
Answers.UserDisplayName: Demerit
Body: <p>Gurus,
  it seems that api3</p>
  <pre><code>civicrm_api3('Activity', 'create', [
    'id' =&gt; 1234,
    'case_id' =&gt; 12,
  ]);
  </code></pre>
  <p>does not assign the activity to the case. From my reading of funtion civicrm_api3_activity_create($params), I can imagine that it depends on enabling the CiviCase setting &quot;Enable deprecated Embedded Activity Revisions&quot; and it won't work without it by design. Could that be?</p>
  <p>I came across this problem when testing the api because Dataprocessor resp. the ActionProvider extensions expose and use the api param case_id without effect.</p>
  <p>My use case is a dataprocessor which processes an event registration which has to be assigned to as case.</p>
  <p>CiviCRM is v5.37.2</p>
  
Tags: <api><civicase><activities>
Title: Assigning existing activity to case via api fails silently - is deprecated activity revisions necessary?
ThreadText: # Assigning existing activity to case via api fails silently - is deprecated activity revisions necessary?
  
  (Asked by: username_0 on 2021-08-24)
  
  Gurus,
  it seems that api3
  
  ```
  civicrm_api3('Activity', 'create', [
    'id' => 1234,
    'case_id' => 12,
  ]);
  
  ```
  
  does not assign the activity to the case. From my reading of funtion civicrm\_api3\_activity\_create($params), I can imagine that it depends on enabling the CiviCase setting "Enable deprecated Embedded Activity Revisions" and it won't work without it by design. Could that be?
  
  I came across this problem when testing the api because Dataprocessor resp. the ActionProvider extensions expose and use the api param case\_id without effect.
  
  My use case is a dataprocessor which processes an event registration which has to be assigned to as case.
  
  CiviCRM is v5.37.2
  
  **Tags:** api, civicase, activities
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-24. Score: 2 | Accepted answer
  
  It's not an "api" exactly, but you can use:
  
  ```
        $caseParams = [
          'activity_id' => 1234,
          'case_id' => 12,
        ];
        CRM_Case_BAO_Case::processCaseActivity($caseParams);
  
  ```
  
  Are you saying the api call used to work before and now is failing? I'm not sure if it ever worked before with an existing activity?
  
  It looks also like in api4 you can do:
  
  ```
  \Civi\Api4\CaseActivity::create()
    ->addValue('activity_id', 1234)
    ->addValue('case_id', 12)
    ->execute();
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks @username_1, I'll edit and clarify my post.  
  > **username_0**: Would CRM_Case_BAO_Case::processCaseActivity($caseParams) inside a drupal module work after bootstrapping civicrm?  
  > **username_1**: Yes I've used it that way before (in drupal 7 at least).  
  
  ---
  
  