When using Account hierarchies in Salesforce, is it necessary to consider the hierarchies when selecting the master record?
Yes. The hierarchy will be broken if a parent record is deleted.
NOTE: This is NOT UNIQUE to merging in DemandTools or DupeBlocker. Salesforce's merge also orphans hierarchies when the non-master record is a parent account. DemandTools and DupeBlocker use Salesforce's merge code to perform the merge, and as such the same behavior applies.
ParentFixer, a free native AppExchange app by Validity
No child account left behind! Install ParentFixer to ensure when a parent account is merged with another account, all of the children are re-parented to the master account in the merge.
NOTE: Although Parent Fixer will prevent orphaned children, it is still best practice to always keep a Parent Account as the master record in a merge whenever possible leaving the existing hierarchy intact.
More information on ParentFixer can be found here.
To install ParentFixer click here.
After a merge is complete, the non-master record is deleted. If that record is a parent account, the hierarchy associated with it will be "orphaned". To avoid or minimize the problem, the parent account should always be chosen as the master record. There is NO field on the account table that indicates a record is a parent account. Therefore, in order to know what records are parent accounts, a custom true/false flag needs to be created and updated before performing any merges. Once this field is in place, then master records can be chosen based on whether this field is "true".
A Single Table Dedupe Master Rule can be created to always keep the parent record using this new field. The rule could be created using a score delta, such that it would ONLY pick masters where one record scored higher, one is a parent and one is not, and the parent is chosen as the master. If both are parents NO master, if none are parents NO master. The latter situation can be merged, but the former should be avoided. See details below.
Three scenarios can occur when merging Accounts with hierarchies:
Scenario#1: Both records are parent accounts
In this case, the child account records should be manually reparented to the Account that will be designated as the master. If the child accounts are not manually reparented, they will be orphaned upon merging. Once the child accounts are reparented, follow steps 1-4 in Scenario#2.
Scenario#2: One record is a parent and the other is not
In this case, to preserve account hierarchies while merging, it is necessary to keep the parent account as the master. This requires creating the custom true/false indicator mentioned earlier in this solution.
To create an indicator on the account records to identify them as parent accounts, follow these steps:
1. Create a true/false field on the Account table called IsParent.
2. Use MassEffect to export all accounts where Parent account ID field does not equal blank. Select the fields to be exported and be sure to include the Parent ID.
3. Once exported, either:
- Dedupe the spreadsheet itself. This will create a unique list of parent account IDs and each parent account will be updated only once. It is important to note that if deduping in the spreadsheet, the 18 digit Account ID is necessary. Excel formulas are not case sensitive and they recognize 0015000000LQHIt as a match to 0015000000lqhLT, therefore, the 15 digit ID should not be used. The 18 digit ID provided from an export using MassEffect is truly unique and should be used when making comparisons on IDs in Excel.
- Proceed to step 4, but if this option is selected, errors may be returned after update due to attempting to update the same record too many times. The error in the in the log file will look like this:
"Message: Maximum number of duplicate updates in one batch (5 allowed). Attempt to update Id more than once in this Api call: 0015000000LQHIt Status code: 39".
4. Using the exported file that contains all the ParentID's, use MassEffect to update the NEW IsParent field equal to true. (Selecting "Update Newly Added Fields" will ensure that it is visible in MassEffect).
Map the ParentID -> ID field on the Account table, and use the "Add Constant" option to set the "IsParent" field to "true" (right-click on the "IsParent" field to add the constant).
NOTE: This is not a dynamic indicator, meaning that if an account is made a parent, or is no longer a parent since the last update, the indicator will not change. Any time this indicator needs to be referenced, use MassImpact to set all records to false and re-run steps 1-4.
Scenario#3: None of the records are parent accounts
- If merging child accounts in the same hierarchy, they will be merged and the subordinate record(s) will be deleted.
- If both are child accounts in different hierarchies, the hierarchy from the master record will be maintained.
- If merging one child account to a stand-alone account the surviving account will be in the hierarchy regardless of which is selected as the master assuming the ParentID field is checked in "Update Where Master Empty" list of fields in the merge controls. This is the default, so unless manually updated this field should be checked already.
- If both are stand-alone accounts, no hierarchies to be considered.