• Manoj jena
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello Guys
am new to Apex code. I would like a trigger to prevent members of a profile from deleting  a change. I have come up with this code but i get an error. Could you help me refine it.
trigger RestrictDelete on BMCServiceDesk__Change_Request__c (before delete) {

String ProfileId = UserInfo.getProfileId();  
for (Change_Request a : Trigger.old)      
            
IF(ProfileId!='profileid'))
{
     a.addError('You cannot delete this record!');
     
            }
}