How to check presence of contact in kentico while importing contact through CSV ?

Joy Basak asked on September 19, 2017 06:40

Hello all ,

Currently I am using kentico 10 so by default its checking presence of a contact by only "EmailAddress" but instead of that i want to check by both "FirstName" and "Email". I think some thing we need to check in Bizform_insertBefore but not sure .Can you please help me out to resolve the same .

Thanks in advance

Joy

Recent Answers


Trevor Fayas answered on September 19, 2017 13:58

insert before would do the trick. you can see the contact through:

ContactInfo theContact = (ContactInfo)e.object;

if you then look up and find a match you can can the e.cancel() i believe, hopefully it will not stop the entire process. If it does, next option is to clean up your csv by manually importing to a temporary table, selecting any non duplicated contacts using SQL, then take that result and make a new clean csv to pass.

0 votesVote for this answer Mark as a Correct answer

Joy Basak answered on September 20, 2017 04:55

@Trevor Fayas
Thanks for the reply . I tried with the insert_before its not even executing the code block because the the contact form is not a Bizform.So bizform insert_before wont work.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on September 20, 2017 15:34 (last edited on September 20, 2017 15:35)

Sorry I should have clarified, you want to use the ContactInfo insert event, not bizform. You're using the wrong hook. Pretty much every class in Kentico has it's own events you can hook into. THis is through the ____Info.TYPEINFO.Events

You want to use the

ContactInfo.TYPEINFO.Events.Insert.Before

Try that!

0 votesVote for this answer Mark as a Correct answer

Steven Steven answered on April 24, 2018 13:58 (last edited on May 16, 2018 13:10)

Thanks for the answer. I will definitely try this code : ContactInfo theContact = (ContactInfo)e.object; Andbal max then I will check if it works or not

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.