Answers.Body: <p>Initially, when I built my view I was missing some relationships - thus the SQL error mentioned above. But even after adding the correct view relationships, the issue still persisted.</p>
  <p>I got huge help from @jackrabbithanna on mattermost. He provided code for a civicrm_customs.module file that will give an &quot;Update Activity Status&quot; VBO action. <a href="https://gist.github.com/jackrabbithanna/34016f1e3dac7c1b44a893cc93eed6db" rel="nofollow noreferrer">https://gist.github.com/jackrabbithanna/34016f1e3dac7c1b44a893cc93eed6db</a></p>
  <p>In notes from his chats:</p>
  <blockquote>
  <p>this provides a separate action, not using &quot;Modify Entity Values&quot; action . . . that sidesteps the entity form irregularities</p>
  <p>could do lots of complex things or whatever with API .. but this shows how to make own VBO action to people</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-12T21:50:24.770Z
Answers.LastActivityDate: 2020-11-12T21:50:24.770Z
Answers.UserDisplayName: RayWright
Body: <p>I'd like to be able to bulk update the status of activities (that happen to be on a case) from a view.</p>
  <p>I can get the status to update but the problem is it loses the Case ID along the way. For example, prior to updating the activity, say it was connected to case 1234. After I run the Bulk Update to change the status of the activity, it sets the case number to 1.</p>
  <p>Any idea how to overcome this? (I'm in Drupal 7.)</p>
  <p>Update: When I add the CiviCRM Activities: Case ID field to the view I get an error:
  <code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'civicrm_activity.case_id' in 'field list'</code></p>
  <p>The field should be civicrm_case_activity.case_id but I can't find in the code of CiviCRMEntity where to make that change.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-08T20:44:15.973Z
Comments.Text: if it does lose it then it would need some fix to the code. i think we added the 'update activity' code so i can ask my colleague when he is around. ps pls mark as D7 or D8
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-08T21:08:43.653Z
Comments.Text: @petednz-fuzion Doh, rookie mistake. I'm in Drupal 7.
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-08T21:30:21.007Z
Comments.Text: not so much a mistake - more that as more sites start using D8 the more we need folk to think to mention what version they are on since the number matters - I will add the d7 tag for you but hoping you can next time.
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-08T21:32:35.737Z
Comments.Text: Totally. I went to add it and didn't see it under the search term 'drupal'. I think because there are som many results now it falls off the selector page. Now I know to use drupal-7 to find the tag.
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-11T22:07:34.853Z
Comments.Text: i agree it is not showing. it used to be an Alias for Drupal and since deleting the alias so we can use it perhaps something hasn't let it show in the searches. i would have to chase this up in a meta channel but will have to wait for my annoyance level to rise enough
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-26T13:01:30.897Z
Comments.Text: I have an update that I'm adding to my post above. I think the reference to the case_id is wrong. When I add the CiviCRM Activities: Case ID to the view I get an error.
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-01T20:23:17.403Z
Comments.Text: Are you using a View Relationship to get the Case ID?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T03:58:56.463Z
Comments.Text: I was not using a view relationship (thanks very much for that tip!!!!) Once I added that the proper Case ID field was available for the view. But when I run the bulk update it still sets it back to 1. I tried setting a view from Activities (relationship to Case ID) Case Activities (relation to case activity id) and from Cases (relationship to activity ID) all of them have the same result. The Case ID reverts to 1.
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T07:46:37.697Z
Comments.Text: i suspect this will need a professional fix. let me know if you an estimate
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T15:16:55.700Z
Comments.Text: Thanks @petednz-fuzion for that confirmation. I'll dig a little and connect with our current consultants. If we do figure it out, promise it'll go back to the community!
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-16T11:08:24.787Z
Comments.Text: Hi Ray, I can see the code from Mark you mentioned. I'm also trying to use VBO to change activity status (d7) using that codehttps://gist.github.com/jackrabbithanna/34016f1e3dac7c1b44a893cc93eed6db. I've added these functions to the VBO module file (views_bulk_operations/views_bulk_operations.module) but I can't see any changes in the View when I add a VBO CiviCRM activity field. I also have Civi entity module installed with Views extras. Am I missing something?
Comments.UserDisplayName: Oliver Gibson
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-16T14:25:38.013Z
Comments.Text: @OliverGibson are you in CiviCRM chat (mattermost)? It might be easier to help there.
Comments.UserDisplayName: RayWright
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-18T14:24:58.760Z
Comments.Text: @RayWright Thanks Ray, I've got this working now. Mark messaged me through mattermost and pointed me in the right direction. Its really useful
Comments.UserDisplayName: Oliver Gibson
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-02-18T17:57:52.013Z
Comments.Text: @OliverGibson - Mark is awesome he was so helpful to me in getting this going as well!
Comments.UserDisplayName: RayWright
Tags: <activities><drupal-views><civicrm-entity><drupal-7>
Title: Can you use VBO to update activities on cases?
ThreadText: # Can you use VBO to update activities on cases?
  
  (Asked by: username_0 on 2020-10-08)
  
  I'd like to be able to bulk update the status of activities (that happen to be on a case) from a view.
  
  I can get the status to update but the problem is it loses the Case ID along the way. For example, prior to updating the activity, say it was connected to case 1234. After I run the Bulk Update to change the status of the activity, it sets the case number to 1.
  
  Any idea how to overcome this? (I'm in Drupal 7.)
  
  Update: When I add the CiviCRM Activities: Case ID field to the view I get an error:
  `SQLSTATE[42S22]: Column not found: 1054 Unknown column 'civicrm_activity.case_id' in 'field list'`
  
  The field should be civicrm\_case\_activity.case\_id but I can't find in the code of CiviCRMEntity where to make that change.
  
  **Tags:** activities, drupal-views, civicrm-entity, drupal-7
  
  > **Comments:**
  > **username_1**: if it does lose it then it would need some fix to the code. i think we added the 'update activity' code so i can ask my colleague when he is around. ps pls mark as D7 or D8  
  > **username_0**: @username_1 Doh, rookie mistake. I'm in Drupal 7.  
  > **username_1**: not so much a mistake - more that as more sites start using D8 the more we need folk to think to mention what version they are on since the number matters - I will add the d7 tag for you but hoping you can next time.  
  > **username_0**: Totally. I went to add it and didn't see it under the search term 'drupal'. I think because there are som many results now it falls off the selector page. Now I know to use drupal-7 to find the tag.  
  > **username_1**: i agree it is not showing. it used to be an Alias for Drupal and since deleting the alias so we can use it perhaps something hasn't let it show in the searches. i would have to chase this up in a meta channel but will have to wait for my annoyance level to rise enough  
  > **username_0**: I have an update that I'm adding to my post above. I think the reference to the case_id is wrong. When I add the CiviCRM Activities: Case ID to the view I get an error.  
  > **username_1**: Are you using a View Relationship to get the Case ID?  
  > **username_0**: I was not using a view relationship (thanks very much for that tip!!!!) Once I added that the proper Case ID field was available for the view. But when I run the bulk update it still sets it back to 1. I tried setting a view from Activities (relationship to Case ID) Case Activities (relation to case activity id) and from Cases (relationship to activity ID) all of them have the same result. The Case ID reverts to 1.  
  > **username_1**: i suspect this will need a professional fix. let me know if you an estimate  
  > **username_0**: Thanks @username_1 for that confirmation. I'll dig a little and connect with our current consultants. If we do figure it out, promise it'll go back to the community!  
  > **username_2**: Hi Ray, I can see the code from Mark you mentioned. I'm also trying to use VBO to change activity status (d7) using that codehttps://gist.github.com/jackrabbithanna/34016f1e3dac7c1b44a893cc93eed6db. I've added these functions to the VBO module file (views_bulk_operations/views_bulk_operations.module) but I can't see any changes in the View when I add a VBO CiviCRM activity field. I also have Civi entity module installed with Views extras. Am I missing something?  
  > **username_0**: @username_2 are you in CiviCRM chat (mattermost)? It might be easier to help there.  
  > **username_2**: @username_0 Thanks Ray, I've got this working now. Mark messaged me through mattermost and pointed me in the right direction. Its really useful  
  > **username_0**: @username_2 - Mark is awesome he was so helpful to me in getting this going as well!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-11-12. Score: 1 | Accepted answer
  
  Initially, when I built my view I was missing some relationships - thus the SQL error mentioned above. But even after adding the correct view relationships, the issue still persisted.
  
  I got huge help from @jackrabbithanna on mattermost. He provided code for a civicrm\_customs.module file that will give an "Update Activity Status" VBO action. <https://gist.github.com/jackrabbithanna/34016f1e3dac7c1b44a893cc93eed6db>
  
  In notes from his chats:
  
  > this provides a separate action, not using "Modify Entity Values" action . . . that sidesteps the entity form irregularities
  >
  > could do lots of complex things or whatever with API .. but this shows how to make own VBO action to people
  
  
  ---
  
  