You need to sign in to do that
Don't have an account?
Alaia Oribello
Compile Error: Expecting '}' but was: 'trigger' at line 4 column 1
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');
}
}
}
}
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');
}
}
}
}
If yes,