• MEER ALI
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
What is wrong with this trigger , it is not working . 
trigger RestrictContactByName on Contact (before insert,before update) {
  
List<Contact> cons = [Select Id from Contact where (Id IN :Trigger.New)];
    for (Contact c : cons)   {
        
        if(c.LastName == 'INVALIDNAME') 
             {
           
            c.AddError('The Last Name "'+c.LastName+'" is not acceptable');
              }

    }

    }