function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DaveGDaveG 

Prevent User from Deleting records but also create new record to log delete attempt

We have users who need to view and update all records but should not be allowed to delete them.  It looks like the only way to do this is by using a before delete trigger.  We created the trigger and used an @future method to log what the user was trying to delete. The problem that we are running into is when we use the add.error to let the user know that they are not allowed to delete the record, it appears that the add.error stops the code from running the @future method.  

Any idea how to get around this?
Pankaj_GanwaniPankaj_Ganwani
Hi Dave, 

Can you please share your code with us?