Restricting Delete for child records is something customizers should start paying special attention towards defining 1:N relationships for entity records.
System Customizers often design this on purpose so that you are aware that the record you are deleting has child records associated with it and cannot be deleted.
Let’s consider this scenario – Account is a parent of Subscription (which is a custom entity)
Error
Assume, Subscription 1 record has Account lookup to record A. Datum Corporation. When you attempt to Delete the Account, you get this error message.
And when you download the Log File from the button on the error message, you can see at the very bottom on the Log that Cascade Delete failed due to the restriction.
It also mentions what child entity is causing it
Reason
The reason being 1:N relationship on the Account entity to Subscription entity.
Workaround
Now, since this is a Restriction on Delete, you can either change it if you are allowed to modify the behavior and it should be fine
However, some system relationships can’t be changed. Example – Opportunity to Quote relationships
To overcome this, you can remove the Opportunity Lookup value on the Quote entity and save the record.
Then, the parent Opportunity can be deleted.
Hope this helps!
[…] Solving ‘The record could not be deleted because of an association’ error in D365 CE […]
LikeLike