Timesheet Oncreated event

J

Jurgen

I extended the event handler for the TimesheetEvents.
At the Oncreated event, we needed to implement some custom logic base on the
newly created timesheet.

The issue we encountered was that we could not retrieve any data out of the
system of this newly created TimesheetUID.
After checking the logs, we saw that the Created event was finsihed before
the CreateTimesheet PSI call was made.
Is this normal behavior and does anybody have a clue of how we can retrieve
the timesheet related data?
 
S

Stephen Sanderlin

It shouldn't be possible for a post event to complete before the PSI
call is complete -- that's simply not the way the architecture works.

One possible explanation: CreateTimesheet() creates a queue job for the
work of creating the timesheet. Event handlers are tied to the PSI calls
and not to the queue jobs they create. Thus, when CreateTimesheet() is
called, it creates a queue job to actually create the timesheet. Once
it's done transmitting its payload to the queue service, the method ends
and the first registered event for the OnCreated event is fired. This
could explain why you are seeing your event finish before the
CreateTimesheet() call is completed.

I assume from your message that you are trying to perform some work on
the new timesheet in the event handler... one option is to create a
WaitForQueue() method in your event handler that would query the queue
for status on the job. Unfortunately, you cannot use the WaitForQueue()
sample code in the SDK because the PSContextInfo class only includes the
TrackingGuid. Thus, you will need to retrieve all jobs for that
TrackingGuid from the Queue and ensure that they are all completed
before processing your work. This will probably require some fairly
complicated code.

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read my blog at: http://www.projectserverhelp.com
Join the community at: http://forums.epmfaq.com
 
J

jlandry

Hello Jurgen,

Depending on waht you want to implement, may I suggest thst you call
OnCreating() Event handler instead. That way, you would be able to get a
Delta dataset in order to accomplish your aim.

But you have to be aware that you are not going to be able to edit this
dataset. I have been through this before and after forwarding my constraint
to Microsoft, they noticed me that this dataset is ther for information
purpose only, like if you would like to extract information and alert someone
using SMTP mail or any other way of notification.

Hope this will help you.

Jean
 
J

Jurgen

We finally managed to get our custom coding in the oncreated event.
We did PSI calls to get the Timesheetdataset that was being created into
our event. From this dataset we could do our manipulations in our custom
database useng the RES_UID and the WPRD_UID.

Manipulations included:
- getting data out of our custom database regarding the previously created
timesheet
- adding custom records to this custom database based on the newly created
timesheet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top