Check record already exist while importing XMLportXMLport

XMLport contains SalutationCode, FirstName, MiddleName, Surname, Address, City, MobilePhoneNo, Email, SalesPersonCode from table Contacts

I try to check if record already exists in database, like this:

OnPostXMLport()

MESSAGE (‘Contact(s) importations successful’);

Contact - Import: : OnAfterInitRecord()

Contact.INIT;
Contact.VALIDATE(Name);
ERROR(‘Record already exist’);

Contact - Import: :OnBeforeInsertRecord()

employerrec .RESET;
IF employerrec .GET(Contact.“Company No.”)= FALSE
THEN ERROR (‘Invalid Employer code for ’ + Contact.Surname +’ ’ + Contact.“First Name” +’ '+ Contact.“Middle Name” );
Contact.“Company Name”:=employerrec.“Company Name PenCom”;

It keep saying “Record already exists” when I import new entries. Thanks

Well of course it does. You code will always show the error. You don’t have a condition (IF) before showing the error. Just as answered in your main question.

So please continue in the other thread. I have closed this thread.