We want to update an additional field when approving e.g. the vendor invoice workflow. This should work for automatical and manual approvals.
Is it wise to add an automated task or an event handler on the update method of the table? What could be performance wise the best solution?
Please share experiences and your thoughts.
Here's my 2 cents.
The performance hit of an additional event handler call is probably small.(I have never measured. It'd be nice if someone who have done that can share the numbers, to proof/disproof this statement.) So if updates is sparse on a table then adding an event handler to the update method, I believe, will not break the system. (One thing to watch out for would be doupdate() calls.)
Also, references to the caller objects/variables are lost but I assume they're not needed here.
On the other hand, it's also interesting to think about what was gained by doing so. And if it is only for one purpose then I haven't come up of any significant advantage yet. (Assuming adding a trigger at-the-spot can be achieved.) It's certainly more convenient though.
Having said that, I would think event handler at table update method is a viable option.
It is arguably easier to maintain if event handlers from multiple spots are gathered and combined in one place.
Also, if, say, 8 out of 10 updates should trigger some sort of event handling anyway. Then the extra 2 calls would have minimal impact on performance.
Many thanks for your inputs. It gave some new insights as well. I preferred the event handler as well, but we are now investigating if the update of this event handler is in time before using another automated task of posting the invoice within the workflow.
It is a bit complicated because I also like to have the same field updated when thinking of using the system without workflow and auto posting enabled.
Thanks for your time and well thought answer. Based on new requirements the solution approach has reconsidered. We have chosen for updating the field within the posting process.
You're welcome. I think I was kind of elaborating on the obvious only and not helping much.
In fact, your question inspired me to give this a good thought, and it was only right that, while isn't much, I replied to this thread with what I came up. =]