• Alaia Oribello
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi All,

Im getting an error like Expecting '}' but was: 'trigger'. Can you help me with this one? Thanks!

@isTest
public class TestRestrictContactByName {

trigger RestrictContactByName on Contact (before insert) {
//check contacts prior to insert or update for invalid data
    For (Contact c : Trigger.New) {
        if(c.LastName == 'INVALIDNAME') {   //invalidname is invalid
            c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
        }

    }

}
}