This is included here to explain what this does, so that we don't do it.
This is the second most powerful and scary function in AX, the second easy function using which we can delete a legal entity.
The SQL statement will be used to truncate the table, so data in all companies is deleted using an SQL command, and all AX validation, triggers, and any other business logic are not run. This can leave you with orphaned records in the system.
Log in to AX as a system administrator.
I have created a TestTable
table and overridden the validateDelete
method so that it doesn't allow the record to be deleted. Furthermore, I have modified the delete
method so that this also generates an error and does not call super() (xRecord.doDelete())
, as given in the following code:
public boolean validateDelete() { return checkFailed("Cannot delete this record"); } public void delete() { error("Cannot delete records in this table."); //super(); }
If we try to delete this table from a form, we will receive the error, Cannot delete this record. If you try to delete it from code, you will receive the error, Cannot delete records in this table, and since super
is not called, the database operation is not performed.
To truncate a table, follow these steps:
TestTable
.18.226.93.137