Service_PreInvokeMethod Event
Siebel CRM calls the Service_PreInvokeMethod event before it calls a specialized method on a business service. For more information, see About Specialized and Custom Methods and Service_InvokeMethod Event.
This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler.
Server Script Format
Service_PreInvokeMethod(MethodName, InputArguments, OutputArguments)
The arguments you can use in this format are the same as the arguments that are described in InvokeMethod Method for a Business Service.
Browser Script Format
Service_PreInvokeMethod(name, inputPropSet)
The arguments you can use in this format are the same as the arguments that are described in Applet_InvokeMethod Event.
Usage with Server Script
Siebel CRM uses the Server Script version of the Service_PreInvokeMethod event to perform the following work:
-
Performing business logic
-
Setting an output in the output property set
-
If you use a custom business service, then returning CancelOperation
Usage with Browser Script
Siebel CRM uses the Browser Script version of the Service_PreInvokeMethod event to perform the following work:
-
Performing a user interaction, such as asking for input data.
-
Setting an input property.
-
Canceling a user operation. For example, prompting the user to confirm a record deletion.
The Browser Script version is not intended to perform business logic. It does not return an output property set.
How Siebel CRM Handles a Predefined Business Service Method
The following image illustrates how Siebel CRM handles a predefined business service method.

With a predefined business service method, the script can do the following - as shown in the previous image:
-
Call the Business Service Method.
-
In the Service_PreInvokeMethod event, process the Method and perform any necessary custom work before it runs the C++ code.
-
When the C++ code runs, it sets values in the outputs that the service code defines.
-
If the C++ code runs successfully, then the Service_InvokeMethod event can inspect and modify the output, or perform other tasks depending on the successful completion of the C++ code. At this point, the calling function takes control of the script flow.
How Siebel CRM Handles a Custom Business Service Method
The following image illustrates how Siebel CRM handles a custom business service method.

With a custom business service method, the script can do the following – as shown in the previous image:
-
Call the Business Service Method.
-
In the Service_PreInvokeMethod event, process the method and take any necessary custom actions.
-
The script must return CancelOperation. This operation configures Siebel CRM to cancel the remaining operations that it associates with the event. If Siebel CRM does not cancel the remaining operations, then the flow continues to the C++ code.
-
This C++ code cannot handle the custom method, so it issues an error that is similar to the following error message:
Unknown method name
-
Siebel CRM cancels the call to the method, so it does not run the Service_InvokeMethod event.
For more information, see Caution About Using the Cancel Operation Event Handler.
Used With
Browser Script, Server Script
Examples
The following Siebel VB example sets properties in the custom Shipping Engine business service:
Function Service_PreInvokeMethod (MethodName As String, Inputs As PropertySet,
Outputs As PropertySet) As Integer
If MethodName = "CalculateShipping" Then
Dim sShipper As String, sShipMethod As String
Dim dWeight As Double, dSize As Double, dCost As Double
Dim sZone As String, DelDate As Variant
Dim sCost As String, iReturn As Integer
iReturn = ContinueOperation
sShipper = Inputs.GetProperty("Shipping Company")
sShipMethod = Inputs.GetProperty("Ship Method")
dWeight = Val(Inputs.GetProperty("Weight"))
dSize = Val(Inputs.GetProperty("Volume"))
iZone = Val(Inputs.GetProperty("Zone"))
DelDate = DateValue(Now)
Select Case sShipper
Case "GlobalEx"
Select Case sShipMethod
Case "Next-Day Air"
dCost = 14 + dWeight
DelDate = DelDate + 1
Case "Second-Day Air"
dCost = 11 + (dWeight * .54)
DelDate = DelDate + 2
End Select
Case "Airline"
Select Case sShipMethod
Case "Next-Day Air"
dCost = 5 + (dWeight * .3) + (dSize * .33) + _
(Val(sZone) * .5)
DelDate = DelDate + 1
Case "Second-Day Air"
dCost = 4 + (dWeight * .3) + (dSize * .2) + _
(Val(sZone) * .3)
DelDate = DelDate + 2
Case "Ground"
dCost = 3 + (dWeight * .18) + (dSize * .1) + _
(Val(sZone) * .1)
DelDate = DelDate + 2 + Int(Val(sZone) * .8)
End Select
End Select
sCost = Format(dCost, "Currency")
Outputs.SetProperty "Cost", sCost
Outputs.SetProperty "Delivery Date", DelDate
iReturn = CancelOperation
End If
Service_PreInvokeMethod = iReturn
End Function