GetService Method for an Application

The GetService method locates a business service. If this business service is not already running, then Siebel CRM starts it. This method returns the name of the business service.

Format

Application.GetService(serviceName)

The following table describes the arguments for the GetService method.

Argument Description

serviceName

The name of the business service to start.

Usage

The GetService method searches through the predefined services that are stored in the Siebel runtime repository. If it does not find the business service that you specify in the serviceName argument, then it searches the business services defined in the run-time Business Services table.

Siebel CRM normally deletes a business service from memory as soon as it clears all references to this business service. The act of setting the business service to another value usually clears these references. If you set the Cache property on the business service to TRUE, then Siebel CRM keeps this business service in memory as long as the Siebel application is running.

Registering a Business Service with a Siebel Application

If you use a Browser Script to call a business service, then you must register that business service with the Siebel application. You must do this to prevent a Service Not Found error. It is not necessary to specify this business service in the CFG file. This requirement does not apply to Server Script.

To register a business service with a Siebel application

  1. In Siebel Tools, in the Object Explorer, click Application.

  2. In the Applications list, locate the Siebel application you must modify.

    For example, Siebel Universal Agent.

  3. In the Object Explorer, expand the Application tree, and then click Application User Prop.

  4. In the Application User Props list, create new application user properties using values from the following table.

    Name Value

    ClientBusinessService0

    XML Converter

    ClientBusinessService1

    My Business Service

    You must enter the ClientBusinessService records sequentially, starting with ClientBusinessService0 and incrementing by 1 for each new ClientBusinessService user property you add.

Used With

Browser Script, COM Data Control, COM Data Server, Siebel Java Data Bean, Mobile Web Client Automation Server, Server Script

Examples

The following examples start a new instance of a business service named Workflow Process Manager.

The following example is in Browser Script:

function Applet_PreInvokeMethod (name, inputPropSet)
{
   if (name == "MyCustomMethod")
   {
      var oBS;
      var inpPS;
      var outPS;
      inpPS = theApplication().NewPropertySet();
      outPS = theApplication().NewPropertySet();
      oBS = theApplication().GetService("Workflow Process Manager");
      outPS = oBS.InvokeMethod("RunProcess", inpPS);
      inpPS = null;
      outPS = null;
      return ("CancelOperation");
   }
   else
   {
      return ("ContinueOperation");
   }
}

The following example is in Siebel eScript:

function WebApplet_PreInvokeMethod (MethodName)
{
   if (MethodName == "MyCustomMethod")
   {
      var oBS;
      var inpPS;
      var outPS;
      inpPS = TheApplication().NewPropertySet();
      outPS = TheApplication().NewPropertySet();
      oBS = TheApplication().GetService("Workflow Process Manager");
      oBS.InvokeMethod("RunProcess", inpPS, outPS);
      inpPS = null;
      outPS = null;
      oBS = null;
      return (CancelOperation);
   }
   else
   {
      return (ContinueOperation);
   }
}

The following example is in Siebel VB:

Function WebApplet_PreInvokeMethod (MethodName As String) As Integer
If MethodName = "MyCustomMethod" Then
   Dim oBS As Service
   Dim inpPS As PropertySet
   Dim outPS As PropertySet
   Set inpPS = TheApplication.NewPropertySet
   Set outPS = TheApplication.NewPropertySet
   Set oBS = TheApplication.GetService("Workflow Process Manager")
   oBS.InvokeMethod "RunProcess", inpPS, outPS
   Set inpPS = Nothing
   Set outPS = Nothing
   Set oBS = Nothing
   WebApplet_PreInvokeMethod = CancelOperation
Else
   WebApplet_PreInvokeMethod = ContinueOperation
End If
End Function