Project server 2007 Timesheet Add line Web part RRS feed

  • Question

  • Hi

    I created a web part which adds non-project timesheet lines to timesheet, for adding lines I have a web service that uses PSI methods and I am calling it in a button_click action in my web part, everything works properly but I have a few problems after the lines are added:

    First, after adding lines although the QueueUpdateTimesheet method has called, they are not visible in the timesheet; therefore, it is necessary to save the timesheet again to see the newly added lines.

    second, if the user refreshes the page before saving the timesheet it seems that the web service runs again with the same input parameters, as a result it throws an exception with the error code 2008=GeneralObjectAlreadyExist; it is clear that it happens because the same lines are going to add again.

    Any idea how to face these problems?


    Tuesday, June 21, 2011 7:12 AM

All replies

  • If a page refresh is done manually, You get the 2008=GeneralObjectAlreadyExist; you can catch the same  error in PSI client constructor & throw a user friendly message. This is a common problem in the pages. If you are refreshing a page manually then the last executed command in the server is repeated. You can set some flags after inserting the data. The best one is to check whether the details are already present in the database but that again requires the server side trip extra load but useful.

    Thanks, Amit Khare |EPM Consultant| Blog:
    Tuesday, June 21, 2011 9:03 AM
  • Thanks for your response. This was the only solution which I found, but the problem is that there is no way to know if a manual refresh caused this exception or the line was really duplicated. Anyway it could be ok!

    It would be great if you have a suggestion for my first problem (see newly added lines in the timesheet after QueueUpdateTimesheet without manually saving the timesheet)


    Tuesday, June 21, 2011 9:30 AM
  • Sorry, I missed out that question but as a process, when you add the new line in time sheet then you save the timesheets. When you save the timesheet, It triggeres the job to update the QueueUpdateTimesheet but if you just call this method, It won't save the time sheet.
    Consider the scenario: If a user adds line in timesheet & closes the page without saving it. If user click NO to save, It simply revert the changes so a save operation is needed to update the timesheet lines. 
    QueueUpdateTimesheet is not sufficient enough to update the Timesheet data.

    Did I make any sense or you need more clarification?

    Thanks, Amit Khare |EPM Consultant| Blog:
    Tuesday, June 21, 2011 9:37 AM
  • Thanks your answer was clear, but what I am expecting is immediately seeing the lines in the timesheet after the "Add line" web service is called, simply like what happens when you add project lines using "Add lines" button and the lines appear on the timesheet right away after clicking ok; if so, there will be no need for saving the timesheet manually just for refreshing the page and seeing those newly added lines.

    Tuesday, June 21, 2011 12:44 PM
  • Hi Amit

    Did you read my last post? Do you have any suggestion for me?


    Saturday, June 25, 2011 6:17 AM