Siebel Object Interfaces Reference > Interfaces Reference > Business Component Events >
The PreDeleteRecord event is called before a row is deleted in the business component. The event may be used to prevent the deletion or to perform any actions in which you need access to the record that is to be deleted.
ContinueOperation or CancelOperation
This event is called after the user has confirmed the deletion of the record, but before the record is deleted from the database.
CancelOperation stops the execution of the underlying Siebel code associated with the event. However, if there is code in the same script following CancelOperation, that code runs regardless of the CancelOperation.
NOTE: The BusComp_PreDeleteRecord and BusComp_DeleteRecord events do not fire for child records that are deleted due to the Cascade Delete property on a link. Such deletes happen directly from the data layer, mainly for performance reasons, while script events are triggered from the object layer and are therefore not executed.
This Siebel VB example prevents the deletion of an account that has associated opportunities:
Function BusComp_PreDeleteRecord As Integer
Dim oBC as BusComp
Dim oBO as BusObject
Dim sAcctRowId as string
sAcctRowId = me.GetFieldValue("Id")
set oBO = TheApplication.GetBusObject("Opportunity")
set oBC = oBO.GetBusComp("Opportunity")
.SetSearchSpec "Account Id", sAcctRowId
If (.FirstRecord = 1) Then
RaiseErrorText("Opportunities exist for the Account - _
Delete is not allowed")
BusComp_PreDeleteRecord = ContinueOperation
Set oBC = Nothing
Set oBO = Nothing