diff --git a/RestrictContactByName.cls b/RestrictContactByName.cls index e41309c..15530e3 100644 --- a/RestrictContactByName.cls +++ b/RestrictContactByName.cls @@ -1,13 +1,9 @@ trigger RestrictContactByName on Contact (before insert, before update) { - //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'); + For (Contact contactObj : Trigger.New) { + //invalidname is invalid + if(contactObj.LastName == 'INVALIDNAME') { + contactObj.AddError('The Last Name "'+contactObj.LastName+'" is not allowed for DML'); } - } - - - -} \ No newline at end of file +}