a guest Jun 18th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trigger PreventTaskDelete on Task (before delete) {
  2.     Id profileid = Userinfo.getProfileId();
  3.     profile profilename = [select Name from Profile where id=:profileid];
  4.     for(Task T1:Trigger.old){
  5.         if(profilename.Name != 'System Administrator'){
  6.             T1.adderror('Task Cannot be deleted');
  7.         }
  8.     }
  9. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand