Last week, I tackled the subject of orphaned records in the Extender tables when the parent records were deleted and the Extender data was left behind. If you have not read this post the link is below:
Removing Extender Data when deleting Transactions or Lines
If you read through the comments, you will see that Konrad Berger (an Australian Partner Consultant) mentions the idea of checking the Open (or History) table to see if the transaction has been moved to the next stage (ie. posted) rather than deleted.
The concept works because most of the posting code in Microsoft Dynamics GP adds the records to the Open (or History) tables before it removed the old record from the Work table. This gives a SQL table trigger the ability to tell the difference between a record being deleted by the user and a record being posted.
So this post will take the triggers attached to the previous post and modify them to use this concept. The updated triggers are shown below and also are attached to this post. These updated triggers can be used in a live system and do away with the need for the Visual Basic for Applications (VBA) code in the previous post.
if
SET
CREATE
DECLARE
select
BEGIN
END
GOSET
You will need to test the triggers for your window to be sure that the concept of checking the Open (or History) table does work for the particular posting code. You should also have the Table Link or SQL Trigger to cleanup when the records are removed from History.
Hope you find this useful. Thanks Konrad for the idea.
David
Posting from DynamicAccounting.net
http://msdynamicsgp.blogspot.com/2010/02/removing-extender-data-revisited.html
PLEASE READ BEFORE POSTING
Please only post comments relating to the topic of this page.
If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.