Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Account merging and it´s related entities

Posted on by 1,835

Hello CRM Community,

I´ve a question regarding Account merging in CRM 2011. I would like to find/get a list of all the related records that get touched as part of the merging of two accounts (Contacts, etc.) Anybody know such a list?

Additionally, when two Accounts are merged, will the related entities simply be `re-parented` from one Account to the other?

Thanks a lot in advance!

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Account merging and it´s related entities

    Hi Magor.

    For getting the list of accounts/contacts that were merged you can use a code found at this link:

    https://community.dynamics.com/crm/b/briteglobalsolutions/archive/2013/03/30/detecting-duplicate-contacts

    For getting the list of related entities (first level child records) I would use a sql query. Probably something like here:

    http://stackoverflow.com/questions/436351/how-do-i-find-a-value-anywhere-in-a-sql-server-database

    - you will just search for an account ID of master record and for the found entities will load ModifiedOn to get the list of reparented entities - their modifiedOn should be the same as modified on of the merge/inactivated accounts modified on.

    HTH

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Account merging and it´s related entities

    Good Morning Aileen,

    why MasterID field is available in advanced search but not available in field list of cases form customization ? It seems to be perfectly set the same as "parentcaseid" field, but this one is available in field list.

    Thanks in advance.

  • Suggested answer
    Magor Kovacs Profile Picture
    Magor Kovacs 1,835 on at
    RE: Account merging and it´s related entities

    Hello Adam,

    Thanks for the reply! Do you know by any chance how I could get a reliable list of entities that are touched during an Account merger?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Account merging and it´s related entities

    The immediate child records are reparented. Child records of child records remain untouched.

    So all Contacts from the deactivated Account are reparented to the Master Account, but the Opportunities, Cases, Activities from those Contacts simply remain attached to the Contacts, and therefore are "under" the Master Account now.

    The immediate child records are modified, so the modified date / user would be one way to start looking at this.

    You could for example, find all Cases that have the customer is a Contact modified today, which in turn have the specified Master Account as the Company.

    But you could not construct a view or similar to do this for all entity types in one place (not without building your own grid control and doing some kind of iterative query).

    Don't forget relationships like Opportunity > Contact > Account > Parent Account. In CRM 2015 you can use the "under" query operator to help a little bit here, but it still won't return multiple entities at once.

  • Suggested answer
    Aileen Gusni Profile Picture
    Aileen Gusni 44,522 on at
    RE: Account merging and it´s related entities

    Hi Magor,

    Basically, the merge request is a process that cannot be undone

    community.dynamics.com/.../the-effect-of-merging-records-on-data-integration.aspx

    "The merge process cannot be undone. If you want to unmerge two records, there is no going back. Once field have been updated and related records like contacts and addresses have been moved to the primary record, there is nothing that tells you what the picture looked like before the merge."

    Once you merge, you can choose which one is the Master right, while the other would become the deactivated record.

    Through the CRM UI, advanced find, there is no flag of this except the deactivated record, a status code  = inactive

    But you don't know which one is merged and to which record is merged, unless for Case there is related merged case you can see through the UI.

    But, for this case, actually CRM has fields: Merged and Master ID for you to see,

    but those fields are mainly for internal user, unfortunately, CRM did not expose it out.

    If you can do SQL Query:

    select accountid,name,merged,mergedname,masterid,masteraccountidname,modifiedon,modifiedbyname from FilteredAccount where merged=1

    If not then you use ODataQuery or using power query in Excel to view the list

    Or you can also query using the SDK.

    Yes, need programmatically.

    Or you can try to interfere the MergeRequest using plugin Merge message to maybe save to another entity the merge record logs or update the merged records field to make it appearing, you can create two custom fields or just use the simple update request Plugin.

    Up to you.

    Can be reparent?

    I think you can do it programmatically as long  you have the merged field and masterID record then it should be possible but little bit though because you don't know which field you were using when you choose to merge field.

    You need to

    - Get the merged record ID

    - Get the merged record Master ID

    - Get the fields changed

    Difficult because you did not know which field you were choosing right?

    Because during Merge form you can choose which field you choose, either from Master record or from another record, once you merge, it will always auto update the Master with new fields (chosen from the merge Form) and deactivate the other one.

    So in this case, undo is not possible, unless your 'undoing' is just to re-activate the deactivated record, but not updating the master record.

    You might try to take a look to the auditing request to get the updated field.

    Kind of a lot of task to do.

    Hope this could give you the concept.

    Thank you so much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans