You need to sign in to do that
Don't have an account?
Ivan Winzer
Duplicate accounts are being created
So over the weekend im not sure what happend but for some reason i have a hand full of accounts that are duplicating on the second. I just did a mass delete of over 10k of the same account and just as soon as i refresh the report the name poped back up and i had another 119 of the same account but not tied to an contact. Here is a trigger an older developer wrote (before my time) and im wondering if something is triggering this to keep creating accounts even though they are not tied to any contacts. can anyone help this is casusing a huge problem as these duplicates are being pushed into other systems with our API calls and integrations.
trigger MainContactTrigger on Contact (before update, before insert, after update, after insert) { DuplicateEmailFilter def = new DuplicateEmailFilter(); Map<id,Contact> oldMap = trigger.oldMap; CreateAccountFromContact accountCreation = New CreateAccountFromContact(); if(oldMap == null){ oldMap = new Map<Id,Contact>(); } if(Trigger.isBefore){ // // For the before creation we check if the contact is getting created by a real user then we use // the Duplicate Email Filter to generate an error preventing the contact from being created. // if(!IntegrationUtils.isIntegrationUser()){ def.processContacts(trigger.new, oldMap); } if( Trigger.isInsert && !IntegrationUtils.ignoreForAutoAccountUser() ) { accountCreation.ProcessBatchContactsWEmail(trigger.new,trigger.oldMap); } else if( Trigger.isInsert || Trigger.isUpdate ) { accountCreation.ProcessBatchContacts(trigger.new,trigger.oldMap); } } else{ // // This is the After trigger - we just need to check if the email address is already // in use in the duplicate email filter. // if it is being created by the integration user then in the DEF we flag the contct as having // a duplicate. Leaving it up to the Salesforce Admin to clean it up. // if(IntegrationUtils.isIntegrationUser()){ def.processContacts(trigger.new, oldMap); } } }
if( Trigger.isInsert && !IntegrationUtils.ignoreForAutoAccountUser() ) {
18 accountCreation.ProcessBatchContactsWEmail(trigger.new,trigger.oldMap);
19 }
20 else if( Trigger.isInsert || Trigger.isUpdate ) {
21 accountCreation.ProcessBatchContacts(trigger.new,trigger.oldMap);
22 }
You need to determine you logic and proceed as needed (remove them? leave them but tweak it ?, etc.)
thx