Siebel Object Interfaces Reference > Interfaces Reference > Application Events >

Application_PreInvokeMethod Event


The PreInvokeMethod event is called before a specialized method is invoked by a user-defined applet menu or by calling InvokeMethod on the application.

Server Script Syntax

Application_PreInvokeMethod(methodName)

Argument
Description

methodName

String variable or literal containing the name of the method invoked

Browser Script Syntax

Application_PreInvokeMethod (methodName, inputPropSet)

Argument
Description

methodName

String variable or literal containing the name of the method invoked.

inputPropSet

A property set containing arguments to be passed to the event.

Returns

"ContinueOperation" or "CancelOperation"

Usage

The PreInvokeMethod event is called just before a specialized method is invoked on the application. If implementing a user-defined method, the script should return CancelOperation if you wish to handle the event entirely through your own scripting.

Specialized methods are methods based on applet or business component classes other than CSSFrame and CSSBusComp, respectively, that is, specialized classes.

When the method to be invoked is part of an If statement, this function's return value must be assigned before the End If statement, as in the following code fragment.

If MethodName = "ResetQuery" then
   Application_PreInvokeMethod = CancelOperation
End If

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

Browser Script, Server Script

Example

The following example is in Siebel VB and shows an implementation of the PreInvokeMethod:

Function Application_PreInvokeMethod (MethodName _
         As String) As Integer

   Dim i As Integer
   Dim iReturn As Integer
   iReturn = ContinueOperation
   
   Select Case MethodName
      Case "LaunchWord"
         i = Shell("C:\Program Files\Microsoft Office _
               \Office\WINWORD.EXE",1)
         iReturn = CancelOperation

      Case "LaunchExcel"
         i = Shell("C:\Program Files\Microsoft Office _
               \Office\EXCEL.EXE",1)
         iReturn = CancelOperation
   End Select
   
   Application_PreInvokeMethod = iReturn

End Function

The following is the equivalent sample in Siebel eScript. Note that for this script to run, the entire Clib.system statement must appear on a single line in the Editor:

function Application_PreInvokeMethod (MethodName)

   var iReturn = ContinueOperation;
   
   switch (MethodName)
   {
      case "LaunchWord":
         Clib.system("\"C:\\Program Files\\Microsoft Office
\\Office\\WINWORD.EXE"",1);
         iReturn = CancelOperation;
         break;

      case "LaunchExcel":
         Clib.system("\"C:\\Program Files\\Microsoft Office
\\Office\\EXCEL.EXE"",1);
         iReturn = CancelOperation;
   }
   
   return (iReturn)
}

See Also

How Your Script Affects Program Flow

Siebel Object Interfaces Reference