Siebel Object Interfaces Reference > Siebel Object Interfaces Reference > Object Interfaces Reference >

Application Events


This topic describes application events. It includes the following topics:

You can use these events only on the Siebel Server, except for the following events that you can use on the Siebel Server or on the browser:

  • Application_InvokeMethod Event
  • Application_PreInvokeMethod Event

Application_Close Event

You can call the Application_Close event before the Siebel application exits. This technique allows scripts to perform cleanup, such as closing a connection to a COM server. Note the following:

  • If Windows notifies the Siebel application that it must close, then Siebel CRM calls this event.
  • If the process is terminated directly, then Siebel CRM does not call this event. For example, a direct termination occurs if the user clicks the close (X) icon at the top right of a window.

This event does not return any information.

Format

Application_Close

No arguments are available.

Used With

Server Script

Siebel Business Processes call this event. For more information, see Siebel Business Process Framework: Workflow Guide.

Application_InvokeMethod Event

Siebel CRM calls the Application_InvokeMethod event after a specialized method is called. This method returns TRUE if the call succeeds or FALSE if the call does not succeed. For more information, see About Specialized and Custom Methods.

Browser Script Format

Application_InvokeMethod(name, inputPropSet)

The arguments you use with this format are the same as the arguments described in Table 25.

This method sends the values you enter in the inputPropSet argument to the InvokeMethod event.

Server Script Format

Application_InvokeMethod(methodName)

The arguments you use with this format are the same as the arguments described in Table 25 except there is no inputPropSet argument.

Used With

Browser Script, Server Script

Related Topics

For more information, see the following topics:

Application_Navigate Event

Siebel CRM calls the Application_Navigate event after the user navigates to a view. This event does not return any information.

Format

Application_Navigate

No arguments are available.

Used With

Server Script

Application_PreInvokeMethod Event

Siebel CRM calls the Application_PreInvokeMethod event before one of the following items calls a specialized method:

  • A custom applet menu that you define
  • The InvokeMethod method

This method returns ContinueOperation or CancelOperation. For more information, see Caution About Using the Cancel Operation Event Handler.

For more information about this method, see About Specialized and Custom Methods and Customizing the Outcome of an Object Interface Event.

Browser Script Format

Application_PreInvokeMethod (methodName, inputPropSet)

The arguments you use with this format are the same as the arguments described in Table 25.

Server Script Format

Application_PreInvokeMethod(methodName)

The arguments you use with this format are the same as the arguments described in Table 25, except there is no inputPropSet argument.

Usage

If the method you instruct Siebel CRM to call is part of an If statement, then you must set the return value for the PreInvokeMethod before the End If statement. The following code is an example of this usage:

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

Used With

Browser Script, Server Script

Examples

The following example is in Siebel VB:

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 example in Siebel eScript. Note that for this script to run, the entire Clib.system statement must reside 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);
}

Application_PreNavigate Event

Siebel CRM calls the Application_PreNavigate event before it displays the view where the user navigates. This event returns CancelOperation or ContinueOperation. For more information, see Caution About Using the Cancel Operation Event Handler.

Format

Application_PreNavigate(DestViewName, DestBusObjName)

Table 54 describes the arguments for the Application_PreNavigate event.

Table 54. Arguments for the Application_PreNavigate Event
Argument
Description

DestViewName

Name of the view where the user navigates.

DestBusObjName

Business object that the destination view references.

Used With

Server Script

Examples

In the following Siebel eScript example, the script Identifies the current business object and sets the current contact Id as a global variable. You can use this variable to keep context:

function Application_PreNavigate (DestViewName, DestBusObjName)
{
   try
   {
      var currentView = this.ActiveViewName();
      var BO = this.ActiveBusObject();
      if(BO.Name() == "Contact")
      {
         var BC = BO.GetBusComp("Contact");
         var id = BC.GetFieldValue("Id");
         TheApplication().SetSharedGlobal("ContactId", id);
      }
   }
   catch (e)
   {
      this.Trace("Exception caught: "+e.toString());
   }
   return (ContinueOperation);
}

Application_Start Event

Siebel CRM calls the Application_Start event when the Siebel client starts and again when it displays the client interface for the first time. This event does not return any information.

CAUTION:  Do not use the RaiseErrorText method in the Application_Start event. The RaiseErrorText method does not work in the Application_Start event, and can cause the Application Object Manager to abort.

Format

Application_Start(commandline)

Table 55 describes the arguments for the Application_Start event.

Table 55. Arguments for the Application_Start Event
Argument
Description

commandline

Text of the command line that starts the Siebel application.

Siebel Business Processes call this event. For more information, see Siebel Business Process Framework: Workflow Guide.

Used With

Server Script

Examples

This example Siebel VB code returns the first and last name of the user who logs in to the Siebel application:

Sub Application_Start(CommandLine As String)
Dim oEmpBusObj as BusObject
Dim oEmpBusComp as BusComp
Dim oEmpBusComp as BusComp
Dim sLoginName as String
Dim sUserName as String

sLoginName = TheApplication.LoginName
Set oEmpBusObj = TheApplication.GetBusObject("Employee")
Set oEmpBusComp = oEmpBusObj.GetBusComp("Employee")
With oEmpBusComp
   .ActivateField "First Name"
   .ActivateField "Last Name"
   .ClearToQuery
   .SetSearchSpec "Login Name", sLoginName
   .ExecuteQuery
   If (.FirstRecord = 1) Then
      sUserName = .GetFieldValue("First Name")
      sUserName = sUserName + " " + .GetFieldValue("Last Name")
   End If
End With

Set oEmpBusComp = Nothing
Set oEmpBusObj = Nothing
End Sub

Siebel Object Interfaces Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.