ActiveBusObject Method for an Application

The ActiveBusObject method returns the name of the business object that the active view references.

Format

Application.ActiveBusObject

No arguments are available.

Usage for the ActiveBusObject Method

Do not use the ActiveBusObject method in an event handler that any of the following technologies can start:

  • COM Data Server

  • COM Data Control

  • Siebel Java Data Bean

Used With

Browser Script, Mobile Web Client Automation Server, Server Script

Example in Browser Script

The following example is in Browser Script:

function Applet_Load ()
{
   var oBusObj;
   oBusObj = theApplication().ActiveBusObject();
   theApplication().SWEAlert("The active business object is " + oBusObj.Name() + 
".")
}

Example of Using the ActiveBusObject Method to Call from a Custom Button on a Child Applet

The following examples include script that runs on the Siebel Server that Siebel CRM can call from a custom button on a child applet in a view. This script does the following work:

  1. Determines if the Contact business object is active. If it is active, then Siebel CRM returns the email address of the currently active parent Contact record.

  2. Uses the contact email address to call the custom SendEmail function.

Objects that the script references are currently active in the Siebel client, so Siebel CRM does not delete these objects at the end of the script.

The following example is in Siebel eScript:

function WebApplet_PreInvokeMethod (MethodName)
{
   if (MethodName == "Send Email")
   {
      var oBO = TheApplication().ActiveBusObject();

      if (oBO.Name() == "Contact")
      {
        var oBC = oBO.GetBusComp("Contact");
         var sEmail = oBC.GetFieldValue("Email Address");

         SendMail(sEmail);
         sEmail ="";
       }
      return (CancelOperation); 
   }
   return (ContinueOperation);
}

The following example is in Siebel VB:

Function WebApplet_PreInvokeMethod (MethodName As String) As Integer
   Dim iRtn As Integer
   iRtn = ContinueOperation

   If MethodName = "Send Email" Then

     Dim oBO As BusObject
      Set oBO = TheApplication.ActiveBusObject()

      If oBO.Name() = "Contact" Then

         Dim oBC As BusComp 
         Dim sEmail As String

         Set oBC = oBO.GetBusComp("Contact")

         sEmail = oBC.GetFieldValue("Email Address")

         SendEmail(sEmail)

         sEmail =""

      End If

      iRtn = CancelOperation

   End If

   WebApplet_PreInvokeMethod = iRtn
End Function