none
Can not update Actuals for newly added Assignments - Project 2010

    Question

  • Hello,

    I am currently in the process of creating a customized timesheet entry page for project server 2010.

    I am using the Statusing client to update actuals for Assignments in the custom timesheet but i have come across the following problem:

    When a task is assigned to a user, it will automatically show up in the user's timesheet (which is fine). At this point if I attempt to update/add actual hours to this new task with the Statusing Client it will not be updated. No error message, it just does not get updated. 

    After some looking around i realized that at this point the TimesheetLine record does not exist in MSP_Timesheet_Lines or MSP_Timesheet_Actuals Database tables or anywhere else that I can find. However it does show up in the user's timesheet AND shows up in the TimesheetDataSet which is returned by the PSI method Timesheet.ReadTimesheet().

    The record does not get added to the MSP_Timesheet_Lines or MSP_Timesheet_Actuals Database tables untill the user goes into their standard timesheet and enters some time in the actuals for the Task and clicks the "Save" button. After doing this the Statusing client will update the Actuals with not problem.

    So my problem is that untill a task has been saved from the standard timesheet, it can not be updated by the Statusing client.

    The only way that i have been able to do this so far is by manually inserting rows into the MSP_Timesheet_Lines or MSP_Timesheet_Actuals Tables which will allow me to update the Task/Assignment with the Statusing client, but i do not think that is a proper solution as it does not update the reporting DB and I do not know how to properly inset a row into the associated MSP_Timesheet_Act_Audit table.

    I have gone through the Timesheet API in the PSI and can not find anything that has helped me. I have tried to use Timesheet.PrepareLine(), but this throws an error when I call QueueUpdateTimesheet (GeneralItemDoesNotExist error).

    Can anyone offer some advice on how to properly Add actuals to a newly added assignment using the PSI?

    Thanks


    • Edited by 5OP-50 Monday, August 13, 2012 6:23 PM
    Friday, August 10, 2012 9:16 PM

All replies

  • Did you ever have success with this?

    I think I'm running into the same problem. So far it seems like the sequence needed to reproduce this is:

      •        A timesheet for the user and period already exists.
      •        An assignment is added which will appear on this timesheet.
      •        The timesheet is then read and updated through the PSI.
      • The Queue job will fail with "GeneralItemDoesNotExist."

    If I "ReadTimesheet" I receive a dataset including the new assignments for the user. If I make changes and then submit the dataset with a QueueUpdateTimesheet, the job eventually fails with a "GeneralItemDoesNotExist" exception. I've tried a number of combinations of PrepareTimesheetLine for the newly added assignments, but haven't had any success.

    Note that I'm not adding new timesheet lines. I'm only adding actuals to the lines that already exist in the TimesheetDataSet.

    (On a related note, I noticed that the TASK_UID for some of the timesheet assignment lines is incorrect, but that doesn't seem to be the root of what I'm encountering.)

    I'm working on the minimal code needed to reproduce this, and expect I'll open a support case for this, but thought I'd see if anyone else had ideas first...

    Jamie Fraser

    Friday, September 28, 2012 3:47 PM
  • The answer from Microsoft Support is that, yes, this is a reproducible bug. If tasks are created after a timesheet was created (and "automatically" added to that timesheet) and saved, then PSI updates of that timesheet will fail.

    Three potential ways to avoid this, but, obviously, none are a good answer:

    1. Delete the timesheet and then recreate it whenever new tasks are added.

    2. Require users to go into PWA, enter 0 on the timesheet and and click on Save. This cleans up the data so the PSI will work.

    3. Don't allow new tasks to be added after timesheets are created. (I have no idea how I could begin to enforce this, even if it were reasonable.)

    Does anyone have any PSI code working that edits existing timesheets? What's the magic for saving timesheet updates after new tasks are added by Project Server?

    Any ideas welcomed!

    Jamie Fraser

    Wednesday, October 10, 2012 4:25 PM
  • I faced the same problem. One more "work-around" for this problem is to update actuals for any other task which existed before (even programmatically). This will "fix" the ability to set actuals for new task as well. But this doesn't seem to be real-life solution i suppose...
    Wednesday, October 10, 2012 7:23 PM
  • Fix I applied: to "rebuild" the timesheet in SingleEntyMode just rename it in separate call, and then perform actuals change.
    • Proposed as answer by James Fraser Thursday, October 11, 2012 2:22 PM
    Thursday, October 11, 2012 8:19 AM
  • As Bill or Ted would say: Excellent! Your suggestion worked perfectly. Even setting the timesheet name to itself and then submitting that to the PSI caused the timesheet to "uncorrupt" and actuals can then be saved to it.

    ds = (TimeSheetWebSvc.TimesheetDataSet)timeSheetSvc.ReadTimesheet(timeSheetUid);
    
    ds.Headers[0].TS_NAME = ds.Headers[0].TS_NAME;
    timeSheetSvc.QueueUpdateTimesheet(Guid.NewGuid(), timeSheetUid, ds);

    Thanks a bunch!

    Jamie Fraser

                   

    Thursday, October 11, 2012 2:22 PM