This content has been marked as final. Show 4 replies
I see your problem, but I think the best solution is for you to manually enter the audit trail record yourself. If it is your program, and you are the one to run the query that deletes from the first table, then you can also add a query that adds in the information you want into the audit trail table.
You could use the host_name() function from SQL. So, if your machines are named as the users, it would essentially be the same as the username. However, since it's a web app, they can log in from any machine, so that might not work.
Alternatively, try setting a coldfusion variable to REMOTE_USER or AUTH_USER. However, that only works if authentication is turned on and the script is protected. Also, I'm not sure that you would be able to use that variable in a trigger. You might have to break it up into two sql batches - the delete and then the insert into the audit table (do this using stored procedures...fast and efficient), like Swift was saying.
I hope that this helps.
Thanks Swift and Chris,
After some messing about it was just easyer to as swift said code in the audit write myself, Thanks Chris as you stated a stored procedure done the trick.
Great! Glad that I could help.