Siebel Object Interfaces Reference > Interfaces Reference > Business Service Events >

Service_PreInvokeMethod Event


The PreInvokeMethod event is called before a specialized method on the business service is invoked.

Syntax

Service_PreInvokeMethod(methodName, InputArguments, OutputArguments)

Argument
Description

methodName

A string representing the name of the method to execute

InputArguments

A property set containing the arguments required by the method

OutputArguments

A property set containing the arguments to be returned by the method

Returns

"ContinueOperation" or "CancelOperation"

Usage

If implementing a new method, or overriding the behavior of a method implemented in a specialized business service, the script should return CancelOperation to avoid invoking an "Unknown method name" error. As Figure 8 illustrates, this error is predictable if the PreInvokeMethod event is scripted. This occurs because there is no native code to execute in the InvokeMethod event. CancelOperation tells the Siebel application to cancel the remaining operations associated with the event.

NOTE:  The example in Figure 8 applies only to new and user-defined methods. For existing standard Siebel methods, it is not necessary to use CancelOperation.

Figure 8. The Effects of CancelOperation and ContinueOperation

Service_InvokeMethod is rarely scripted, but can be used for such post-operation events as posting a notice to a log when the event completes successfully.

Used With

Browser Script, Server Script

Example

This Siebel VB example creates the new service "Shipping Engine."

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("Total Dimensions"))
      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

See Also

Service_InvokeMethod Event

Siebel Object Interfaces Reference