0 Replies Latest reply on Jun 10, 2008 1:41 PM by (nickl)

    delete mutiple image with custom trigger

      I am attempting to delete multiple images associated with a record being deleted. The record has a field with the default filename, then each image has a prefix ("thumb_", "callout_", "feature_") along with this filename.

      My issue is two-fold. I am attempting this with a custom trigger (on the delete record; using AFTER), but I keep getting an error message when I try to pull in the filename using tNG->getColumnValue(). The error reads:

      tNG_fields.getColumnValue:
      Column file is not part of the current transaction.

      Here is my code:

      $file = $tNG->getColumnValue('file');
      deleteFileAndThumbs($file);

      My second issue is in regards to the redirect after the triggers.

      getPrimaryKeyValue() works just fine. Thus, if I change the image names to correspond to my record's "id" #, it will pull the ID # just fine. It will make it through my code and redirect back to the listing page. However, the images will not be deleted. If I remove the redirect, the images delete, but it just sits on this page. So I assume my issue is a result of the page redirecting before al the images are deleted. Is there a way to not allow the redirect to run until my deleteImages function is completed?

      Thanks!