I've written a stored procedure which captures the cost of a Job at the point at which it is Released. The SP works fine but I've realised that there's a problem with choosing when to trigger it.
My first attempt was to append a Formscript method to the StatusChg, this works but if the user changes their mind and doesn't save, then the cost snapshot is written at the wrong time. So better to trigger it at the end of the save events. I have 2 choices:
StdObjectSaveCompleted
StdObjectSaveCurrentCompleted
I think that if I fire my SP from StdObjectSaveCurrentCompleted then the snapshot will only be taken for the record the user is looking at when they press save. So if they've moved off the Job whose Status they changed, then the snapshot will fail. If anyone knows otherwise, I'm happy to be corrected.
If, however, I use StdObjectSaveCompleted then either:
My formscript has to iterate through the each row of the collection and decide if it has been changed and if so see if my SP needs to fire. I feel sure that there is a Property which tells me if the record has changed but I can't see which one. Can anyone advise?
Or
I need to fire my SP from an Application Event. This would work but seems kind of clunky.
Thanks in advance
Rees