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.

Server Script 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

Browser Script Syntax

Service_PreInvokeMethod(name, inputPropSet)

Argument
Description

name

A string representing the name of the method to execute

inputPropSet

A property set containing the arguments required by the method

NOTE:  In Browser Script, output property sets are not supported for this event.

Returns

"ContinueOperation" or "CancelOperation"

Usage

The Server Script version of this event is used for the following:

  • Performing business logic
  • Setting any outputs in the output property set
  • Returning CancelOperation (assuming a custom business service)

The Browser Script version is used for the following:

  • User interaction, such as asking for input data
  • Setting input properties
  • Canceling user operations, for example "Are you sure you want to do this?"

NOTE:  The Browser Script version is not intended to perform business logic, and does not return an output property set.

Figure 7 illustrates the differences in how standard and custom business service methods are handled.

Figure 7. Differences in Handling Standard and Custom Business Service Methods
Click for full size image

With a standard method, the script can intercept Method in the Service_PreInvokeMethod event and take any necessary custom actions before the C++ code is executed. The C++ code then executes, setting values in the outputs as defined by the service code.

If the C++ code executes successfully, the Service_InvokeMethod event can be used to inspect the outputs, modify them if necessary, or perform other tasks dependent on the successful completion of the C++ code. At that point, the calling function regains control of the script execution.

With a custom method, the script can intercept Method in the Service_PreInvokeMethod event and take any necessary custom actions.

The script must return CancelOperation. CancelOperation tells the Siebel application to cancel the remaining operations associated with the event. If not canceled, the code flow would continue to the C++ code, which does not have the ability to handle the custom method, and would therefore throw an "Unknown method name" error (indicated by X in Figure 7).

Because the method invocation is canceled, the Service_InvokeMethod event is not executed (indicated by X in Figure 7).

Used With

Browser Script, Server Script

Example

This Siebel VB example sets properties in a new 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

Related Topic

Service_InvokeMethod Event

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.