+ Start a Discussion
Angela SchloederAngela Schloeder 

trigger does not include "Confirm Delete" popup

We have a trigger that doen't allow users to delete an Event, but admins that can delete events do not get the popup to confirm they do want to delete. How can I get the popup again?

trigger EventDelete on Event (before delete) {
    if([SELECT PermissionsModifyAllData FROM Profile WHERE Id = :UserInfo.getProfileId()].PermissionsModifyAllData) {
        return;
    }
    for (Event sb : Trigger.old) {
        sb.addError('Cannot delete an Event');
    }
}
Abhi_TripathiAbhi_Tripathi
For ADMIN PermissionsModifyAllData check will be always true, so that is why it's not working for Sys Admins, try removing that and check again