Siebel Object Interfaces Reference > Interfaces Reference > Business Component Events >

BusComp_PreDeleteRecord Event

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.




Not applicable



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.

Used With

Server Script


This Siebel VB example prevents the deletion of an account that has associated opportunities.

(general) (declarations)
Option Explicit

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")

   With oBC
      .SetViewMode AllView
      .ActivateField "Account Id"
      .SetSearchSpec "Account Id", sAcctRowId
      .ExecuteQuery ForwardOnly
      If (.FirstRecord) = 1 Then
         RaiseErrorText("Opportunities exist for the Account - _
            Delete is not allowed")
         iReturn = CancelOperation
      End If
   End With

   BusComp_PreDeleteRecord = iReturn

   Set oBC = Nothing
   Set oBO = Nothing

End Function

Siebel Object Interfaces Reference