Project Server Timesheets: What happens when I delete a project or assignment?

Take 2 – just in case you thought you saw this post coming earlier…

I’ve had a few questions recently around the behavior of timesheets in Project Server 2010 and 2013 (and Project Online) when projects, tasks or assignments are deleted.  Some of this relates to bugs – other behavior is expected, and it is different if single entry mode is enabled.  Thanks to Shazeb Khan, Michael Wharton, Elli Johnston and Randy Slycord for some of the questions and answers that led to this posting – and skip to the And finally section at the bottom for a timesheet status bug we are looking to fix..

Firstly it is worth reviewing the article on TechNet Best practices for submitting and reporting on actual work, which, although written for 2010 is still applicable for Online and 2013.  That suggests using Single Entry Mode – but I will go on to explain what happens if it is enabled or not. 

First with Single Entry mode, and I’m looking specifically at Project Server 2013 – I’ll mention where 2010 differs from this behavior…  For this example I have just a couple of projects, three timesheets; one approved, one submitted and one saved.  Each has lines from each plan – then I delete one of the plans…

What happens next is a little like Schrödinger's cat – the lines in some of the timesheets are still there – as long as you don’t try to observe them (well not a perfect analogy as you can look in the database – but mentioning a cat in the blog must push this up the page ranking!).  In the database (reporting schema) we see that the Approved lines are still there (TimesheetLineStatus = 1), the pending lines are still pending (0) and one of the Pending Approval lines is now rejected (2) with a comment of  “The timesheet has been rejected because it contained at least one task from a project that has been deleted.”

Database view of the timesheet

If I look at the MSP_TimesheetActual table I still see all 30 rows (5 entries for each of the 2 plans for 3 weeks).  Now I’ll open my timesheet…

Remember I mentioned a bug?  Well here it is.  Clicking OK gives ‘An unknown error has occurred’.

View failure message

This will be fixed in the April 2014 Cumulative Update for Project Server 2013.  This will also cause an issue in the Approval Center – giving an error ‘One or more categories of approval could not be loaded’.  Thanks Michael Wharton for asking about this message – the term categories is not referring to anything like the Project Server categories – just being used generically.

I can recall my timesheet and then remove the Rejected line and resubmit.

Timesheet showing rejected task

For the timesheet that was just saved I currently see slightly different behavior between 2010 and 2013.  In 2013 I still see the line for my assignment to the deleted project.  And I can re-save – but if I submit my timesheet then I get an error.  This is also related to the April 2014 fix.

Error on webpage

In 2010 the database almost looks the same, but I did notice something I hadn’t seen before – and haven’t had a chance to check for any different settings – but I have 42 actual lines rather than 30 – I see line entries for the weekend – zero hours as I might expect – but these aren’t seen in 2013.  If I look at the timesheet that was saved and not submitted the assignment to the deleted project no longer shows, but it is not until I save that the line is removed from the database (this is the Schrödinger's cat part).  So if you are reporting on the timesheets you may still see lines for plans that have been deleted – if the user has not opened and saved the current timesheet after the plan was deleted.  The lines are still there – unless you look at them.  Even the pending approval lines can appear to disappear – as the change in status to rejected may also throw out your reports for lines that had not been approved – if you are using the TimesheetLineStatus field.  This was a conversation from the Project Conference with Elli Johnston as it appeared from reports that we were deleing lines – but it was just a change in status (and this was not single entry – so I’ll look at that next…).

The main difference in single entry mode (apart obviously that the submission of the timesheet does not send status updates) is how the deleted assignments are handled.  First 2010.  If I follow the same steps as above then instead of the timeline disappearing it get changed, and in place of the project name I see Personal Tasks. Again, not until I save this do I see any change in the database – which still shows the line as pending… 

Personal Task

Once I do save however, I will see the TimesheetLineStatus change to a 3 (Not Applicable).  This was the specific change that was occurring in Elli’s scenario making it look like line were disappearing from reports – but it was the status had changed.  If the timesheet has been submitted or approved then the project name is kept and the status stays good (1).

In 2013 currently the deleted assignment is still present in the timesheet and has a status of 4 (Pending Approval) – this feels like it is part of the bug mentioned above as I’d expect the same behavior as 2010 – I’ll review once I have the April CU loaded and update this posting.

And finally…

Another condition we have seen with timesheet status (not line status) in Project Server 2013, not related to deletion of projects, is that you can get the wrong timesheet status value in the reporting tables under certain conditions.  An approved timesheet should show the status of 3, but this is being reset to 0 when status is accepted against tasks in the timesheet.  It is a timing issue, and if the status update is processed before the timesheet approval then all is good – so this could be a workaround if you are hitting this problem.  This only happens in Single Entry Mode.  This doesn’t affect the display of the timesheet status in Manage Timesheets (which gets its status from the pub schema) – just reporting (coming from the dbo schema).  Thanks to Randy and the Sensei team for pointers on this one, and to Shazeb for suggesting the topic worth blogging.  This is in the queue for a hotfix but I don’t have a schedule yet.

Cats were neither harmed nor not harmed during the preparation of this blog post.