Is there trigger to check duplicate phone and email?
Closed 5 years ago. I’ve to write trigger on lead object to check duplicate phone and email. one checkbox field Named Duplicate on lead object. If duplicate record found , checkbox to be checked.
How to check for duplicates in SQL trigger?
CREATE OR REPLACE TRIGGER Check_Duplicate before insert or update on properties FOR each ROW declare v_dup number; begin select count (idProperties) INTO v_dup from properties where Address_FK=:NEW.Address_FK and Ownership_FK=:NEW.Ownership_FK; if v_dup > 0 then Raise_Application_Error (-20100, ‘This property already exists.
How to check duplicate email in the trigger while insert and update?
It will help other to find best answer. I used your code, but found a bug while finding duplicates record on base of Email in the imported batch, i.e. If imported batch have duplicate email itself it doesn’t handle that. I tried suresh code it is working fine i used data import wizard for loading and it is working fine
How to prevent duplicate contact in Salesforce apex?
Populate the above List with of existing records whose email id or phone number matches the ones being created. Iterate through each record being created and display and error if the record already exists. Now lets go through each step once again and write its respective code.
How to check duplicate email address in Salesforce?
// isn’t changing during an update as a duplicate. + ‘same email address.’); // of the leads being inserted or updated. + ‘address already exists.’); You should use before update event in your trigger. Try the below code.
How to prevent duplicate triggers in Salesforce code?
trigger to prevent duplicate trigger. 1 Always use Upsert call instead of Insert call. It will automatically check the duplicates i.e. link with existing… 2 Create duplicate-matching rules. More