You have two tables named CustTable and Cust Group. Each record in CustTable references a record in Cust Group.
You need to create a delete action to ensure that the records in Cust Group can be deleted only if there are no records in CustTable that reference the record in Cust Group.
What should you do?
A. On Cust Group, create a Cascade delete action for CustTable.
B. On Cust Group, create a Restricted delete action for CustTable.
C. On CustTable, create a Restricted delete action for Cust Group.
D. On CustTable, create a Cascade delete action for Cust Group.
Correct Answer: B
Explanation/Reference:
Delete Action: Restricted
Restricts deletion in the current table if data is present in related tables.
Note:
Setting the DeleteAction property to Restricted extends the functionality of the table’s validateDelete method.
As a result, super(), in validateDelete, checks whether records exist on related tables. If records do exist, validateDelete returns false. The forms system ensures that the deletion is not performed. In your own X++ code, check the return value of validateDelete. Don’t delete the primary or related records if the method returns false.
Example
On the CustTable table, a restricted delete action has been defined for the CustTrans table. When a customer is deleted in the CustTable table, the validateDelete method ascertains whether transactions exist for the customer in the CustTrans table. If so, validateDelete returns false.
Reference: How to: Create Delete Actions [AX 2012]