Delete Actions and OnDelete property indicates how deletions in the main table are handled in the related tables or child tables.There are 3 types of options are available i.e. Cascade , Restricted & CascadeRestricted.
The delete action and OnDelete property (available only Microsoft D365 finance and operations) helps to maintain database consistency.
But in Microsoft Dynamics 365 finance and operations we have 2 options available.
First one is traditional approach which was also available in Microsoft Dynamics AX i.e. Delete Actions.
Second one is new approach and recommended in Microsoft Dynamics 365 for finance and operations . This include defining “On Delete” property Below is the screenshot:
No matter what approach you choose you have only 3 options available.
First type and option is CASCADE. For example : If you have one parent table A and you have one child or related table B . If you are going to use CASCADE delete action or On delete property then on deletion of records in TABLE A , related records in TABLE B will also get deleted.
Second type and option is RESTRICTED. For example : If you have one parent table A and you have one child or related table B . If you are going to use RESTRICTED delete action or On delete property then on deletion of record in TABLE A , system will not validate records in related Table B.If related record exits in Table B then system will not allow you to delete record in Table A and throw an error
Second type and option is CASCADE RESTRICTED. For example : if we have 3 tables i.e. parent table Vehicle & related tables Car & CarManufacturer. Table CarManufacturer is child or related table of Table CAR and similarly Table CAR is child or related table of parent Table Vehicle. If we will set the delete action CASCADE in between Parent Table Vehicle and Related Table CAR and again if we will set the delete action CASCADE RESTRICTED in between Table CAR and Related Table CarManufacturer. Then on deletion of record in Parent TABLE VEHICLE, system will also delete all the related records of TABLE CAR & CarManufacturer. But if you will try to delete records in Car and related records exists in Table CarManufacturer then system will not allow to delete rocords.
Microsoft Dynamics AX, Microsoft Dynamics 365 for Finance and Operations, D365 FO, Retail, SQL, Microsoft Power Apps, Microsoft Power BI, Microsoft Azure, Logic Apps, Microsoft Flow, Microsoft power automate, Microsoft Power Platform,.Net, X++, C#, Power BI DAX, Data Warehousing, Microsoft Analysis Services, SQL Server Reporting Services