• Eklavyam
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello,
My trigger :

trigger stopTaskDelete on Task (before delete) {
    Id profileid = Userinfo.getProfileId();
    profile profilename = [select Name from Profile where id=:profileid];
    for(Task T1:Trigger.old){
        if(profilename.Name != 'System Administrator'){
            T1.adderror('You can not delete task');
        }
    }
}

How can I make this trigger work via Handler class? and how do I write test class for this?
Hello,
My trigger :

trigger stopTaskDelete on Task (before delete) {
    Id profileid = Userinfo.getProfileId();
    profile profilename = [select Name from Profile where id=:profileid];
    for(Task T1:Trigger.old){
        if(profilename.Name != 'System Administrator'){
            T1.adderror('You can not delete task');
        }
    }
}

How can I make this trigger work via Handler class? and how do I write test class for this?