Sequence of Events: Deletion of a Data Record
The figure below illustrates the sequence of events raised during the deletion of a data record.

A data record is deleted when a user deletes the record on the user interface, the
deletion request is sent through the Web Service API, or the Delete()
method of a data view is invoked in code. As a result of the deletion, the data record gets
the Deleted status if it already exists in the database, or the
InsertedDeleted status if the record has just been inserted into the
PXCache object and deletion from the database is not required. The data
record is later available through the Deleted and
Dirty collections of the PXCache object.
If the deletion has been initiated by a user on the UI or through the web services API, the following field events are raised for each key data field before any other events are raised:
FieldUpdatingFieldUpdated
Next, regardless of how the deletion was initiated, data record events are raised as follows:
RowDeletingis raised. At this point, the developer can still stop the deletion by throwing a PXException instance or by settinge.Canceltotrue. Note that throwing an exception will interrupt the code execution and roll back any changes. However, settinge.Canceltotruewill allow code execution to continue, and the PX.Cache.Delete will returnnull. This option provides the developer with the opportunity to use their custom business logic to handle the failed record deletion sequence. In theevariable representing event data,e.Rowholds the data record being deleted.- If
e.Canceldoes not equaltruethenRowDeletedis raised, ande.Rowstill holds the data record.
