Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Relationship Configuration: Opposite Direction, Parental Deletion?

Posted on by

I want basically the opposite of the Parental Deletion.

Normally, when you delete a parent record, the child record is deleted; but if you delete a child record, the parent remains.

What I want to happen is: when you delete the child record, the parent is deleted. If the parent is deleted, child should also be deleted.

Is this possible? And if so, is it possible without code?

*This post is locked for comments

  • aforsythe Profile Picture
    aforsythe on at
    RE: Relationship Configuration: Opposite Direction, Parental Deletion?

    I'm going to try the bulk delete - thanks!

  • Verified answer
    David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Relationship Configuration: Opposite Direction, Parental Deletion?

    You could try:

    1. Create an additional relationship between the entities, but in the opposite direction, and set a Cascade Delete on this relationship
    2. Create a workflow that runs on the Delete of the child entity. In this workflow, set the lookup field for the new relationship from the parent to the child. This workflow would need to be a synchronous workflow on the Before step

    I'm not certain this would work; you may get a locking issue or a circular relationship error. If it doesn't work, you could write a simple custom workflow activity to delete the parent record (taking an input parameter to specify the record to delete), and call this from a workflow on the Delete of the child entity.

    Another option could be to set a flag field on the parent record (again via a workflow on the Delete of the child entity) and have a bulk deletion job that deletes records with this flag set. This will only run periodically (e.g. every week), so there would be a delay in the deletion

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans