The
OnBeforeRecordDeleted event can be used to validate the deletion of a record. In this example the application checks that a customer does not have any orders (using the
executeSingletonQuery method) before allowing the deletion of the customer record.