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

Applet Events


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

Overview of Applet Events

Siebel CRM calls an applet event in reply to a user interaction. You can manage each event for each applet.

The format for an applet event that you use on the browser is Applet_event.

where:

  • event is the name of the event.

For example, Applet_ChangeFieldValue. If the event includes the Applet prefix, then you can use it only on the browser.

The format for an applet event that you use on the Siebel Server is WebApplet_event.

where:

  • event is the name of the event.

For example, WebApplet_InvokeMethod. If the event includes the WebApplet prefix, then you can use it only on the Siebel Server.

Applet_ChangeFieldValue Event

The Applet_ChangeFieldValue event starts if the user uses an applet to modify data in a field. It does not return any information. For more information, see Applet_ChangeRecord Event.

Format

Applet_ChangefieldValue(fieldname, fieldValue)

Table 22 describes the arguments for the Applet_ChangeFieldValue event.

Table 22. Arguments for the Applet_ChangeFieldValue Event
Argument
Description

FieldName

A string that contains the name of the field that the user modified.

FieldValue

A string that contains the value that the user modified.

Usage

Note the following usage of the Applet_ChangeFieldValue event:

  • If the user moves to a different record but does not modify a value in the previous record, then the ChangeFieldValue event does not start.
  • If the user modifies the value of a field, and if Siebel CRM modifies the value in another field that depends on some way on the value that the user modified, such as a calculated field, then the event starts once for each field whose value Siebel CRM modifies.
  • If the user uses a pick applet or popup applet to modify the data that a field contains, then this event does not start.
Used With

Browser Script

Examples

The following example is in Browser Script:

function Applet_ChangeFieldValue (field, value)
{
   try
   {
      switch (field)
      {
         case "Primary Revenue Committed Flag":
         if (value == "Y")
         {
            var thisBC = this.BusComp();
            var sRev = thisBC.GetFieldValue("Primary Revenue Amount");
            var sUpside = thisBC.GetFieldValue("Primary Revenue Upside Amount");
            var total = sRev + sUpside;
            if (total < 500000)
            {
               thisBC.SetFieldValue("Primary Revenue Committed Flag", "N");
               theApplication().SWEAlert("Changing the Committed Flag to NO as
                 $500,000 in Revenue and Upside amount is required");
            }
         }
         break;
      }
   }
   catch(e)
   {
// error handling routine
}

Applet_ChangeRecord Event

Siebel CRM calls the Applet_ChangeRecord event if the user moves to a different record or view. It does not return any information. For more information, see Applet_ChangeFieldValue Event.

Format

Applet_ChangeRecord()

No arguments are available.

Used With

You use the Applet_ChangeRecord event with Browser Script. Note the following:

  • To return the value of the field the user navigates to, use the BusComp.GetFieldValue method.
  • To return the value of the field the user navigates away from, use the control.GetValue method.
Examples

The following example is in Browser Script:

function Applet_ChangeRecord ()
{
   try
   {
      var thisBC = this.BusComp();
      var sFlag = thisBC.GetFieldValue("Primary Revenue Committed Flag");
      if (sFlag == "Y")
      {
         theApplication().SWEAlert("This record cannot be updated because it has
         been committed");
      }
   }
   catch(e)
// error handling routine

}

Applet_InvokeMethod Event

The Applet_InvokeMethod event can start if any of the following items occur:

  • A call to applet.InvokeMethod occurs
  • A call to a specialized method occurs
  • A user chooses a menu item in a menu that the user defines

For more information, see About Specialized and Custom Methods.

This method does not return any information.

Format

Applet_InvokeMethod(name, inputPropSet)

Table 23 describes the arguments for the Applet_InvokeMethod event.

Table 23. Arguments for the Applet_InvokeMethod Event
Argument
Description

name

The name of the method that Siebel CRM calls.

inputPropSet

A property set that identifies arguments that Siebel CRM sends to the event.

Usage

This method sends information you specify in the inputPropSet argument to the PreInvokeMethod event. You can use the Applet_InvokeMethod event to display or hide controls, or to set a search specification. To access a business component from this event handler, do the following:

  • Use this.BusComp.
  • Do not use TheApplication.ActiveBusComp.
Used With

Browser Script

Examples

Some methods can create, modify, or delete records. These actions might call an event at the applet or business component level. If you require Siebel CRM to perform a specific action before or after the method run, then you can use these events. The following example includes custom code in the PreInvokeMethod event and the InvokeMethod applet event. For more information, see Applet_PreInvokeMethod Event.

To set the fields, this code sets and resets the flag and uses the NewRecord server event:

function Applet_PreInvokeMethod (name, inputPropSet)
{
   if (name == "Quote")
   {
      // Add code that Siebel CRM must run BEFORE the special method
      // Set flag to "1"
      theApplication().SetProfileAttr("flag","1");
   }

   return ("ContinueOperation");
}

function Applet_InvokeMethod (name, inputPropSet)
{
   if (name == "Quote")
   {
      // Add code that Siebel CRM must run AFTER the special method
      // Reset the flag to "0"
      theApplication().SetProfileAttr("flag","0");
   }

}

function BusComp_NewRecord ()
{
   if (theApplication().GetProfileAttr("flag")== "1" )
   {
      this.SetFieldValue ("Field1", "Value1");
      this.SetFieldValue ("Field2", "Value2");
      . . . . .
   }

}

Applet_Load Event

Siebel CRM calls the Applet_Load event after it loads an applet and displays the data for that applet. It does not return any information.

Format

Applet_Load()

No arguments are available.

Usage

To hide or manipulate controls or to set properties on an ActiveX Control in a form applet, you can use the Applet_Load event. You can manipulate the following types of controls:

  • CheckBox
  • ComboBox
  • TextBox
  • TextArea
  • Label

If you must display a dialog box, then do not use the SWEAlert method or the RaiseErrorText method with the Applet_Load event. This technique can cause the browser to fail if Siebel CRM has not fully rendered the Siebel application in the browser.

Used With

Browser Script

Examples

You can use the following example only with code on a form applet:

function Applet_Load ()
{
   // Get the control instance.
   var ctrl = this.FindControl("FirstName");

   // Hide the control
   ctrl.SetProperty("Visible","false");

   // Hide the label
   ctrl.SetLabelProperty("Visible", "hidden");
}

Applet_PreInvokeMethod Event

Siebel CRM calls the Applet_PreInvokeMethod event immediately before it calls a specialized method on an applet. The Applet_PreInvokeMethod event can start if any of the following items occur:

  • A call to the InvokeMethod method on an applet occurs.
  • A user chooses a custom menu item that you define in Siebel Tools.

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

For more information, see About Specialized and Custom Methods.

Format

Applet_PreInvokeMethod(name, inputPropSet)

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

Used With

Browser Script

Examples

function Applet_PreInvokeMethod (name, inputPropSet)
{
   if(name == 'NewRecord')
   {
      if(confirm("Are you sure you want to create a new record?"))
         return ("ContinueOperation");
      else
         return ("CancelOperation");
      return ("ContinueOperation");
   }
}

WebApplet_InvokeMethod Event

Siebel CRM calls the WebApplet_InvokeMethod event after a specialized method on the Web applet runs. WebApplet_InvokeMethod starts only for a predefined method. It does not start for a custom method. For more information, see About Specialized and Custom Methods.

This method does not return any information.

Format

WebApplet_InvokeMethod(methodName)

Table 24 describes the arguments for the WebApplet_InvokeMethod event.

Table 24. Arguments for the WebApplet_InvokeMethod Event
Argument
Description

methodName

String variable or literal that contains the name of the method that Siebel CRM calls.

Used With

Server Script

Examples

The following example is in Siebel eScript:

switch (MethodName)
{
   case "NewQuery":
      TheApplication().SetSharedGlobal("EnableButton", "N"); break;
   case "ExecuteQuery":
      TheApplication().SetSharedGlobal("EnableButton", ""); break;
   case "UndoQuery":
      TheApplication().SetSharedGlobal("EnableButton", "");
   break;
}

The following example is in Siebel VB:

Select Case MethodName
Case "NewQuery"
   TheApplication.SetSharedGlobal "EnableButton", "N"
Case "ExecuteQuery"
   TheApplication.SetSharedGlobal "EnableButton", ""
Case "UndoQuery"
   TheApplication.SetSharedGlobal "EnableButton", ""
End Select

Related Topics

For more information, see the following topics:

WebApplet_Load Event

Siebel CRM calls the WebApplet_Load event immediately after it loads an applet. It does not return any information.

Format

WebApplet_Load()

No arguments are available.

Usage

To avoid returning a null value, do not call TheApplication.ActiveBusObject from the WebApplet_Load event. Instead, you can use this.BusObject to get a reference to the current business object.

Used With

Server Script

Examples

The following example is in Siebel eScript:

function WebApplet_Load ()
{
   try
   {
      var currBC = this.BusComp();
      with (currBC)
      {
         SetViewMode(OrganizationView);
         ClearToQuery();
         SetSearchSpec("Last Name", "A*");
         ExecuteQuery(ForwardBackward);
      }
   }
   catch (e)
   {
      TheApplication().RaiseErrorText(e.errText);
   }
}

The following example is in Siebel VB:

Sub WebApplet_Load
   Dim iReturn As Integer
   Dim currBC As BusComp
   Set currBC = Me.BusComp
   With currBC
      .SetViewMode OrganizationView
      .ClearToQuery
      .SetSearchSpec "Last Name", "A*"
      .ExecuteQuery
   End With
End Sub

Related Topics

For more information, see the following topics:

WebApplet_PreCanInvokeMethod Event

The WebApplet_PreCanInvokeMethod event allows a script to determine if the user possesses the authority to call the applet method. Siebel CRM calls this method in the following situations:

  • Before it calls the PreInvokeMethod event.
  • If the user steps to a different record.
  • If it loads an applet.
  • If it calls a different method from Browser Script. For example, the GetProfileAttr method or the SetProfileAttr method.

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

Format

WebApplet_PreCanInvokeMethod(MethodName, &CanInvoke)

Table 25 describes the arguments for the WebApplet_PreCanInvokeMethod event.

Table 25. Arguments for the WebApplet_PreCanInvokeMethod Event
Argument
Description

MethodName

A string that contains the name of the method that Siebel CRM must run.

&CanInvoke

A string that indicates if Siebel CRM call the applet method. You can use the following values:

  • TRUE. Siebel CRM can call the applet method.
  • FALSE. Siebel CRM cannot call the applet method.

Usage

Using the FirstSelected business component method with the PreCanInvokeMethod event can cause unexpected behavior in a pick applet that Siebel CRM calls from the applet where this event is called.

To enable and disable a method, it can be easier to use the CanInvokeMethod applet user property at the applet level. For an example, see Using a MiniButton Control to Call a Custom Method. For information about the CanInvokeMethod user property, see Siebel Developer's Reference.

Used With

Server Script

Examples

The following example is in Siebel eScript:

function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
   if ( MethodName == "CustomMethod" )
   {
      CanInvoke = "TRUE";
      return( CancelOperation );
   }
   return (ContinueOperation);
}

The following example is in Siebel VB:

Function WebApplet_PreCanInvokeMethod (MethodName As String, CanInvoke As String) As Integer
   Dim iReturn As Integer
   iReturn = ContinueOperation
   If MethodName = "Test" Then
      CanInvoke = "TRUE"
      iReturn = CancelOperation
   End If
   WebApplet_PreCanInvokeMethod = iReturn
End Function

WebApplet_PreInvokeMethod Event

Siebel CRM calls the WebApplet_PreInvokeMethod event before it calls any of the following:

  • A specialized method for the Web applet.
  • A custom method that Siebel CRM calls through the oWebApplet object of the InvokeMethod method.

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

For more information, see About Specialized and Custom Methods.

Format

WebApplet_PreInvokeMethod(methodName)

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

Used With

Server Script

Examples

The following example is in Siebel eScript:

function WebApplet_PreInvokeMethod (MethodName)
{
   switch (MethodName)
   {
   case "CustomMethod":
      var applet = this;
      var BC = applet.BusComp();
      var ConId = BC.GetFieldValue("Contact Id");
      var WshShell = COMCreateObject("WScript.Shell");
      WshShell.Popup("My Custom Method was called. Here is the ID " + ConId);
      return(CancelOperation);
      break;
   }
   return (ContinueOperation);
}

The following example is in Siebel VB:

Function WebApplet_PreInvokeMethod (MethodName As String) As Integer
   Dim iReturn As Integer
   iReturn = ContinueOperation
   Select Case MethodName
   Case "CustomMethod"
      Dim oBusComp As BusComp
      Set oBusComp = Me.BusComp
      Dim WshShell As Object
      ConId = oBusComp.GetFieldValue("Contact Id")
      Set WshShell = CreateObject("WScript.Shell")
      WshShell.Popup("My Custom Method was called. Here is the ID " & ConId)
      iReturn = CancelOperation
   End Select
   WebApplet_PreInvokeMethod = iReturn
End Function

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