You need to sign in to do that
Don't have an account?
SfdcDevLJ
We have an integration with a legacy system and we use an Unique ExternalID to send personAccount upserts back and forth between salesforce and the legacy system using JItterbit.
However, that externalID is provided by the legacy system, When a new record is created in Salesforce it is sent to the legacy system where it gets the Unique ExternalID. Problem is on the way back to Salesforce since the ExternalID isn't already on the Account, Jitterbit creates a new duplicate account. I was workign on the code above but not sure if it will get me what i'm trying to accomplish.
Update field in existing Account from trigger.new Avoid Duplicate
trigger AccountDuplicateTrigger on Account (before insert, before update) { //Create map of existing person accounts that don't have a externalID map<Id, Account> existingAccountMap = new Map<ID, Account>([Select ID, Name, externalID__c FROM Account WHERE isPersonAccount=True AND externalID__c = Null]); //For new trigger accounts check if Name exists in existingAccountmap for(Account a : trigger.new) { map<ID, Account>newAccountMap = new Map<ID, Account>([SELECT ID, Name, externalID__c FROM Account WHERE ID IN :trigger.newMap.keySet()]); //If new account name matches an existing account then put UUID in the existing account if(a.name = existingAccountMap.get(a.ID).Name) { ......... } } }
We have an integration with a legacy system and we use an Unique ExternalID to send personAccount upserts back and forth between salesforce and the legacy system using JItterbit.
However, that externalID is provided by the legacy system, When a new record is created in Salesforce it is sent to the legacy system where it gets the Unique ExternalID. Problem is on the way back to Salesforce since the ExternalID isn't already on the Account, Jitterbit creates a new duplicate account. I was workign on the code above but not sure if it will get me what i'm trying to accomplish.
I will need to try to match the incoming accounts with the SFID__c if UniqueID field is blank