Restricted Delete Action in Table D365 F and O
In case of Restricted Delete Action you can delete record from parent table if there is no dependent data in child table. If there will be dependent data, system will show warning message that data present in child table. So to delete record from parent table first we have to delete all records from child table which is dependent after that we will be able to delete record from parent.
Remember if we want to apply the Restricted delete operation on Employee Table then we have to create relationship on the Employee Table and apply On delete property Restricted to it on relationship.
- You need two table
Department table
andEmployee Table
. - Create a normal relationship between them in Employee table.
- Set on delete property in Employee table as Restricted. See screenshot.
- Then build and run to see result. When we will try to delete records from Employee table then Department Table data will not be deleted automatically, It will show below warning message.
Department Table cannot be deleted while dependent EmployeeTable exist. Delete dependent EmployeeTable and try again.
- So, to delete record from Department table first delete all dependent data from EmployeeTable. Then you will be able to delete record from Department table.
Another way you can do that also
Remember if we want to apply the Restricted delete operation on Department Table then we have to create relationship on the Department Table and apply On delete property Restricted to it on relationship.
- You need two table
Department table
andEmployee Table
. - Create a normal relationship between them in Department table.
- Set on delete property in Department table as Restricted. See screenshot.
- Then build and run to see result. When we will delete records from Employee table then Department Table data will not be deleted automatically, It will show below warning message.
Employee Table cannot be deleted while dependent DepartmentTable exist. Delete dependent DepartmentTable and try again.
- So, to delete record from Employee table first delete all dependent data from DepartmentTable. Then you will be able to delete record from Employee table.
You will get error like below.
Comments
Post a Comment