Search Here

Write a trigger, only the system admin user should be able to delete the task.

 trigger taskThatCanBeDeletedBySA on Task (before delete) {

Id pid = Userinfo.getProfileId();

Profile pname=[select Name from Profile where id=:pid];

for(Task taskObj:Trigger.old){

if(pname.Name!='System Administrator'){

taskObj.addError('No Access for Deletion');

}

}

}

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.