Table Delete Action in D365 F&O | Examples

Rumman Ansari   Software Engineer   2023-06-09   2807 Share
☰ Table of Contents

Table of Content:


Table Delete Action in D365 F&O

There are four types of delete actions in Microsoft Dynamics 365 Finance & Operations:

  1. None
  2. Cascade
  3. Restricted
  4. Cascade + Restricted

You can apply the delete action through Delete Action node in primary table if you don't have relationship with the child table.

Delete Action in Table D365 F&O

You can apply the delete action through On delete Property in related table if you have relationship (normal) with the primary table.

Delete Action in Table D365 F&O

None

Delete action disabled: The None delete action does not delete any related records when a record is deleted. This is the default delete action.

Cascade

The Cascade delete action deletes all related records when a record is deleted. This is useful for ensuring that data is always consistent, such as when a customer is deleted, all of their orders and invoices are also deleted.

Example

On the CustTable table, a cascading delete action has been defined for the CustBankAccount table. When a customer is deleted from the CustTable table, the delete method also ensures that the corresponding bank account information is automatically deleted.

Read more about Cascade Delete Action.

Restricted

The Restricted delete action prevents a record from being deleted if there are any related records. This is useful for preventing accidental data loss.

Learn more about Restricted delete action.

Cascade + Restricted

The Cascade + Restricted delete action is a combination of the Cascade and Restricted delete actions. When a record is deleted, all related records are deleted, but only if there are no other records that are related to those related records. This is useful for ensuring that data is always consistent, while also preventing accidental data loss.

Learn more about Restricted delete action.

The delete action that is used for a particular record is determined by the DeleteAction attribute on the table that contains the record. The DeleteAction attribute can be set to one of the four values listed above.

Here are some examples of how the different delete actions can be used:

  1. To ensure that all customer orders and invoices are deleted when a customer is deleted, the DeleteAction attribute on the Customer table can be set to Cascade.
  2. To prevent a user from deleting a customer if they have any orders or invoices, the DeleteAction attribute on the Customer table can be set to Restricted.
  3. To ensure that all customer orders and invoices are deleted when a customer is deleted, but only if there are no other orders or invoices that are related to those orders or invoices, the DeleteAction attribute on the Customer table can be set to Cascade + Restricted.
  4. The delete action that is used can have a significant impact on the data integrity of your system. It is important to carefully consider the needs of your business when choosing the delete action for each table in your system.