Page 1 of 1

How to Link Insert to Delete Transaction

Posted: 2014-07-29 12:23
by Accumike
Hi everyone,

I was going to post this as a query, but while writing this the solution occured to me, so I thought I would share it:

I have a DB table that logs User activity. Every time a record is added, changed or deleted, it will store the User id and the transaction type (add, change, delete).

I have used the Link Transactions feature to insert a new log record for any add or change transactions. The Insert is triggered by the KT_Insert1 or KT_Update1 id as usual.

So far, so good. However, how to link the Insert to any Delete transaction? The Link Transactions SB just shows the one Insert transaction, so I can't link this to the Delete transaction.

As it turns out, it is possible to do it the other way round and fire the Delete off an Insert transaction. Set up your usual Insert transaction (in my case all with hidden fields), with KT_Insert1 as the trigger id. Then set up your Delete transaction in the usual way, but use KT_Insert1 as the trigger for the Delete. That's it - the record deletes as usual and a log of the User activity is stored as a new record in the logger table.

Obvious really... Hope this helps someone!

Michael

Re: How to Link Insert to Delete Transaction

Posted: 2015-02-27 13:55
by Accumike
Returning to this... I forgot to add that you need to put the code for the Delete transaction before the Insert / Update transaction.