function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MikoMiko 

Deleted accounts

Hi,
 
One of the business requirements when merging accounts of different record types is to make sure that a certain record type remains the active record. 
 
Ex.  Account 1 has rec type 1
       Account 2 has rec type 2
 
The requirement is to make sure that account 2 will remain active after the merge.  We can not enforce this rule in salesforce in case the user makes a mistake and choose account 1 as the master record.
 
What we did is to correct the merge outside salesforce and update account 1 with the attributes of account 2.  The problem is one of the custom fields in the account object is defined as unique and I get a duplicate value error when doing the update.  
 
Here are my options:
1.  Is there a way to trigger a physical delete of  the logically deleted record so I won't get the duplicate value error?  I tried to clear the recycle bin but the logically deleted record is still in the table.
 
2.  Can we limit validation for uniqueness to active records only?  What's an efficient way of doing this?
 
Thanks in advance for any input.
Michael SnowMichael Snow
I would like to know the best way to do this as well.

You could change the custom external id field to allow for nulls.  Then on your merge process, null out the one you are about to delete. 

Another approach would be to increase the length allowed by that field so that you can append some characters to the id field of the merged record before you delete it.
MikoMiko

Thanks for the input. 

Does it mean that we can alter the behavior out-of-the-box merge process?  The options you suggested need to happen when doing the merge.  If there's a way to alter the merge process then that's great.

What I'm doing now is just let the merge go through and then correct the data after the fact.