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.
This Siebel VB example prevents the deletion of an account that has associated opportunities.
Function BusComp_PreDeleteRecord As Integer
Dim iReturn as integer
Dim oBC as BusComp
Dim oBO as BusObject
Dim sAcctRowId as string
iReturn = ContinueOperation
sAcctRowId = me.GetFieldValue("Id")
set oBO = TheApplication.GetBusObject("Opportunity")
set oBC = oBO.GetBusComp("Opportunity")
.ActivateField "Account Id"
.SetSearchSpec "Account Id", sAcctRowId
If (.FirstRecord) = 1 Then
RaiseErrorText("Opportunities exist for the Account - _
Delete is not allowed")
iReturn = CancelOperation
BusComp_PreDeleteRecord = iReturn
Set oBC = Nothing
Set oBO = Nothing