Obtaining service last run DateTimestamp

I am wanting to run a service that will query Trading Networks, setting the query start date to the last time the service was run. I was going to schedule the service and use the last run date/time that the scheduled service last ran, however realised that when the scheduled job was run, the last run date time would be zero, as the scheduled job would be running!

As I see it, if there is not another way, i will need to write the current date/time to a file when the service is run and have it read the file on subsequent runs to obtain the last run date/time.

Is there a simpler way to achieve this desired result?


We had a requirement before to execute the interface based on last successfull execution time. We used wm.tnweb.querySvc:getDocuments TN service which would query the TN database based on the TN document type. Along with many other fields this service would return time stamp indicating when the document was routed to TN.

You can try using this service if you are routing the document to TN.