Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

(1) ShareShare
ReportReport
Posted on by 15

Hello

I have duplicated records from an entity called "Ville/City" and I want to merge them, I know there is a feature in dynamic CRM to merge duplicates but the problem is that it doesn't work for custom entities (at least this is what I know from my research)

so I need to delete the duplicated records from a batch program but to delete the said records I need first to reassociate all the relationships of all those records to a master record before deleting the other duplicate (doing the work manually from a program)

I already have a program that gets the GUID of duplicated records grouped together, the question is there a way to update the related records faster without having to write the logical name of each related entity and also the logical name of the lookup field to update?

This is the image of the entity "Ville" and its 1:N relationships (as you can see there is many so I want to know if there is a way to quickly update all these relationships) 

5037.Screenshot_5F00_6.png

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

    If my reply (or replies) answers your question take a minute and verify the answer. You can do it by clicking "Yes" at the top of the reply (or replies) under the label "Does this answer your question?"

  • Aimad q Profile Picture
    Aimad q 15 on at
    RE: How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

    No problem man.

    well, I think there is no other solution than that I was trying to find a quick way to other the 2 steps without manually writing the entity name and the field to be updated but it seems there is no other way.

    Thanks.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

    Ahh. I understood you the wrong way. I thought you experience issues with the deletion of referenced records. Early morning here so I'm sorry for that.

    I'm afraid you will have to do that in 3 steps:

    1. Collect and analyze the existing data to find duplicates and decide what is the master record and what is a duplicate.

    2. Query all the data that references duplicates and update it with the corresponding master record.

    3. Delete records that are considered duplicates.

  • Aimad q Profile Picture
    Aimad q 15 on at
    RE: How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

    Thank you for the recommendation.

    but if I used  "Remove Link" it will just be the same! It will remove the duplicated records and the link between the record "Ville/City" and its related entities but I still need to update the related records and assign them to the master record (the original record that will not be deleted)

    or maybe I didn't understand something?

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How to get 1:N relationtishps without knowing the entity logical name and the logical name of the lookup field?

    Hello,

    I might recommend an easier workaround - find those relationships and change the behavior from Referential - Restrict Delete to Referential - Remove Link.

    pastedimage1666096042827v1.png

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans