Answers.Body: <p>It looks like Case creates 2 SQL views</p>
  
  <p>civicrm_view_case_activity_upcoming
  civicrm_view_case_activity_recent</p>
  
  <p>And in case dashboard/ find case results- these views are called on to provide upcoming and recent activity data.</p>
  
  <p>When the database was restored from backup. These views had been emptied. And upcoming/ most recent activity data was showing as empty on the dashboards.</p>
  
  <p>A colleague found some related SQL commands in
  public_html/sites/all/modules/civicrm/CRM/Case/BAO/Case.php
  function createCaseViewsQuery line 3057</p>
  
  <p>And by running the related SQL Query was able to repopulate the views. These now automatically repopulate each time an activity is added.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-15T17:41:20.720Z
Answers.Text: This was really useful, thanks Craig, got me out of a hole. Perhaps needs to be reported as a bug? I had this exact problem after restoring a 5.28.3 system.
Answers.UserDisplayName: Andy Clark
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-15T17:51:16.570Z
Answers.Text: I added a comment to this issue https://lab.civicrm.org/dev/core/-/issues/2262
Answers.UserDisplayName: Andy Clark
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-17T11:47:52.900Z
Answers.Text: Thanks for taking up the issue Andy, I think i'd assumed it was a local issue rather than a more generic one.
Answers.UserDisplayName: Craig Almond
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-18T15:20:23.100Z
Answers.LastActivityDate: 2019-02-18T15:20:23.100Z
Answers.UserDisplayName: Craig Almond
Body: <p>In the case dashboard (D7, Civi 5.8.2)</p>
  
  <p>The lists of cases with recently performed or upcoming activities are showing no results
  <a href="https://i.sstatic.net/pKu2Z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/pKu2Z.png" alt="snapshot of case dashboard"></a></p>
  
  <p>Even though I know there are cases that meet the criteria.</p>
  
  <p>Additionally the find cases results list is not showing any links under Most Recent or Next Scheduled</p>
  
  <p><a href="https://i.sstatic.net/qIKL8.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qIKL8.png" alt="case results list"></a></p>
  
  <p>I think this is a local issue. I had a problem with the site yesterday and restored to overnight backup.</p>
  
  <p>Looks like no data is lost, but these activities aren't showing</p>
  
  <p><strong>UPDATE</strong>
  My colleague has found 2 SQL views upcoming and most recent activities. Which were not rebuilt during the back up process.</p>
  
  <p>Waiting for confirmation from client all is as expected. Will post more details as an answer later.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T15:07:26.860Z
Comments.Text: Have you tested against a more recent version than 5.8.2? Was it always like this for this installation or did something there change recently?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T15:18:34.860Z
Comments.Text: Hi Demerit, I was in the middle of editting as you posted.
  
  This is following a db backup yesterday. Functionality was lost after back up.
  
  sandbox works as expected. other sites with case installed work as expected
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T15:25:16.187Z
Comments.Text: So on manage case for a given case the activities show? if they don't show there, then sounds like something wrong with the civicrm_case_activity table.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T15:38:42.030Z
Comments.Text: Yes all activities show in individual case management views. Am "fairly" confident all the activities are there that should be.
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T15:46:09.687Z
Comments.Text: I might check the civi logs and see if there's any warnings. Can also turn on sql debugging and see if the dashboard query might give a clue. https://wiki.civicrm.org/confluence/display/CRMDOC43/Debugging
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T16:06:32.240Z
Comments.Text: CiviCRM debugging and backtrace enabled- no error messages
  
  Drupal Watchdog logging enabled
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T16:06:59.340Z
Comments.Text: Went back to case dashboard
   Message: Notice: Undefined index: all in CRM_Case_Page_AJAX::getCases() (line 201 of /home/newpip/public_html/sites/all/modules/civicrm/CRM/Case/Page/AJAX.php).
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T16:15:10.383Z
Comments.Text: Try SQL debugging, to see what it's actually trying to pull to give a clue to what's missing, not civicrm debugging.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T16:27:14.360Z
Comments.Text: Does it let you create a new case? If you add an activity to a case does it then show on the dashboard as recent?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T16:35:36.720Z
Comments.Text: Yes we can add new cases.
  
  They appear in the summary of involvement table on the dashboard
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T17:13:03.160Z
Comments.Text: Hi Demerit. Quick word to say thanks for your suggestions so far.
  
  We're going to try and re-install the back up onto a fresh site to see if the issue lies with the back up process.
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T17:19:19.797Z
Comments.Text: No prob. I'm out of ideas at the moment.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-14T21:35:11.977Z
Comments.Text: clear caches, clear caches and once more clear caches?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-15T10:50:32.607Z
Comments.Text: Yup, we did a lot of that.
Comments.UserDisplayName: Craig Almond
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-15T19:04:02.547Z
Comments.Text: Probably a stupid suggestion, but a drupal view could give you the data you want but no idea what CMS you are on.
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-18T15:21:41.243Z
Comments.Text: Hi Pete it is drupal, but it's some core case features that are not working as expected so a new view wouldn't work here. See answer below.
Comments.UserDisplayName: Craig Almond
Tags: <civicase>
Title: Case Dashboard- Cases with upcoming activities and Cases with recently performed activities lists show empty
ThreadText: # Case Dashboard- Cases with upcoming activities and Cases with recently performed activities lists show empty
  
  (Asked by: username_0 on 2019-02-14)
  
  In the case dashboard (D7, Civi 5.8.2)
  
  The lists of cases with recently performed or upcoming activities are showing no results
  [![snapshot of case dashboard](https://i.sstatic.net/pKu2Z.png)](https://i.sstatic.net/pKu2Z.png)
  
  Even though I know there are cases that meet the criteria.
  
  Additionally the find cases results list is not showing any links under Most Recent or Next Scheduled
  
  [![case results list](https://i.sstatic.net/qIKL8.png)](https://i.sstatic.net/qIKL8.png)
  
  I think this is a local issue. I had a problem with the site yesterday and restored to overnight backup.
  
  Looks like no data is lost, but these activities aren't showing
  
  **UPDATE**
  My colleague has found 2 SQL views upcoming and most recent activities. Which were not rebuilt during the back up process.
  
  Waiting for confirmation from client all is as expected. Will post more details as an answer later.
  
  **Tags:** civicase
  
  > **Comments:**
  > **username_1**: Have you tested against a more recent version than 5.8.2? Was it always like this for this installation or did something there change recently?  
  > **username_0**: Hi username_1, I was in the middle of editting as you posted.  This is following a db backup yesterday. Functionality was lost after back up.  sandbox works as expected. other sites with case installed work as expected  
  > **username_1**: So on manage case for a given case the activities show? if they don't show there, then sounds like something wrong with the civicrm_case_activity table.  
  > **username_0**: Yes all activities show in individual case management views. Am "fairly" confident all the activities are there that should be.  
  > **username_1**: I might check the civi logs and see if there's any warnings. Can also turn on sql debugging and see if the dashboard query might give a clue. https://wiki.civicrm.org/confluence/display/CRMDOC43/Debugging  
  > **username_0**: CiviCRM debugging and backtrace enabled- no error messages  Drupal Watchdog logging enabled  
  > **username_0**: Went back to case dashboard  Message: Notice: Undefined index: all in CRM_Case_Page_AJAX::getCases() (line 201 of /home/newpip/public_html/sites/all/modules/civicrm/CRM/Case/Page/AJAX.php).  
  > **username_1**: Try SQL debugging, to see what it's actually trying to pull to give a clue to what's missing, not civicrm debugging.  
  > **username_1**: Does it let you create a new case? If you add an activity to a case does it then show on the dashboard as recent?  
  > **username_0**: Yes we can add new cases.  They appear in the summary of involvement table on the dashboard  
  > **username_0**: Hi username_1. Quick word to say thanks for your suggestions so far.  We're going to try and re-install the back up onto a fresh site to see if the issue lies with the back up process.  
  > **username_1**: No prob. I'm out of ideas at the moment.  
  > **username_2**: clear caches, clear caches and once more clear caches?  
  > **username_0**: Yup, we did a lot of that.  
  > **username_2**: Probably a stupid suggestion, but a drupal view could give you the data you want but no idea what CMS you are on.  
  > **username_0**: Hi Pete it is drupal, but it's some core case features that are not working as expected so a new view wouldn't work here. See answer below.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-02-18. Score: 3 | Accepted answer
  
  It looks like Case creates 2 SQL views
  
  civicrm\_view\_case\_activity\_upcoming
  civicrm\_view\_case\_activity\_recent
  
  And in case dashboard/ find case results- these views are called on to provide upcoming and recent activity data.
  
  When the database was restored from backup. These views had been emptied. And upcoming/ most recent activity data was showing as empty on the dashboards.
  
  A colleague found some related SQL commands in
  public\_html/sites/all/modules/civicrm/CRM/Case/BAO/Case.php
  function createCaseViewsQuery line 3057
  
  And by running the related SQL Query was able to repopulate the views. These now automatically repopulate each time an activity is added.
  
  > **Comments:**
  > **username_3**: This was really useful, thanks username_0, got me out of a hole. Perhaps needs to be reported as a bug? I had this exact problem after restoring a 5.28.3 system.  
  > **username_3**: I added a comment to this issue https://lab.civicrm.org/dev/core/-/issues/2262  
  > **username_0**: Thanks for taking up the issue username_3, I think i'd assumed it was a local issue rather than a more generic one.  
  
  ---
  
  