4 Replies Latest reply on Sep 11, 2007 7:43 AM by MEsquivel

    delete log email

      Hi i have a mysql database, and a fairly large crm system, there are some entries in my database which being deleted somehow, and there are a few different delete option pages.

      is there away of getting an email sent to me when a row is deleted from a table called enquiries, with the actual page name that delete accured, so i can find out where this is happening.

      so i would get an email with

      item deleted from table enquiries

      this was deleted from page deleteenquiry.cfm
        • 1. Re: delete log email
          Level 7
          for starters, just put an appropriate cfmail tag right after any delete
          cfquery you want to keep an eye on - that will fire off every time the
          delete query is executed

          as for requesting page name - depends where your delete queries are: if
          in cfc's you will probably have to pass in another argument with current
          page's name into the cfc and then use it in the cfmail; if they are in
          same cfm pages as the link/button to execute deletion, then use
          cgi.script_name; if the delete query is in a separate cfm page (i.e.
          delete_email.cfm), then try using cgi.http_referer instead (not sure
          about this one if the delete is fired through form submission, though,
          but will probably work, too...)

          as alternative to email, consider using <cflog> tag....


          Azadi Saryev
          • 2. Re: delete log email
            KeithLaw999 Level 1
            yes but what i am looking for is a global solution, so is there a way of using the application page to send me an email if the delete function is used?
            • 3. Re: delete log email
              Level 7
              i see...

              i am afraid there is no easy solution like that, if any at all...

              technically, one probably (this is me just hypothesising here...) could
              "under the hood" of cfquery tag and write some custom java which extends
              it to do what you want.... but i guess this will also bee way too
              rdbms-specific to implement on any wider scale...

              but then again i may be wrong, and someone smarter than me is meanwhile
              typing exactly the code you need...


              Azadi Saryev
              • 4. Re: delete log email
                What DBMS are you using?

                Can you add a trigger to that table, in order to insert information on a log table on the delete event, and have a CF component read this log and send the mail to you?

                Not really sure if this is what you're looking for ...