Configuring Siebel Open UI > Customizing Siebel Open UI > Doing General Customization Tasks >

Calling Methods for Applets and Business Services


This topic includes some examples that describe how to call methods for applets and business services. For other examples that call methods, see the following topics:

Calling Methods for Applets

The example in this topic describes how to call a method for an applet when the user clicks a button.

To call methods for applets

  1. Modify the physical renderer:
    1. Use a JavaScript editor to open the physical renderer for the applet that you must modify.
    2. Locate the onclick code for the button that you must modify.
    3. Add the following code to the code you located in Step b:

    var inPropSet = CCFMiscUtil_CreatePropSet();
    //Define the inPropSet property set with the information that InvokeMethod sends as input to the method that it calls.
    var ai= {};
    ai.async = true;
    ai.selfbusy = true;
    ai.scope = this;
    ai.mask = true;
    ai.opdecode = true;
    ai.errcb = function(){
      //Code occurs here for the method that Siebel Open UI runs if the AJAX call fails
      };
    ai.cb = function(){
      //Code occurs here for the method that Siebel Open UI runs if the AJAX call is successful
      };
    this.GetPM().ExecuteMethod("InvokeMethod", input arguments, ai);

    where:

    • input arguments lists the arguments that InvokeMethod sends as input to the method that it calls.

      For example, the following code specifies to use the InvokeMethod method to call the NewRecord method, using the properties that the inPropSet variable specifies for the ai argument:

    this.GetPM().ExecuteMethod("InvokeMethod", "NewRecord", inPropSet, ai);

    For more information, see InvokeMethod Method for Application Models and NewRecord Method.

  2. Modify the presentation model:
    1. Use a JavaScript editor to open the presentation model for the applet that you must modify.
    2. Locate the code that calls the Init method.
    3. Add the following code to the code that you located in Step b:

    this.AttachPreProxyExecuteBinding("method_name", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs before the applet proxy sends a reply.});

    this.AttachPostProxyExecuteBinding("method_name", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs after the applet proxy sends a reply.});

    where:

    • method_name identifies the name of the method that InvokeMethod calls. Note that Siebel Open UI comes predefined to set the value of the methodName argument in the following code to WriteRecord, by default. You must not modify this argument:

    function(methodName, inputPS, outputPS)

    For example:

    this.AttachPreProxyExecuteBinding("WriteRecord", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs before the applet proxy sends a reply.});

    this.AttachPostProxyExecuteBinding("WriteRecord", function(methodName, inputPS, outputPS){// Include code here that Siebel Open UI runs after the applet proxy sends a reply.});

    For more information, see WriteRecord Method, AttachPostProxyExecuteBinding Method, and AttachPreProxyExecuteBinding Method.

Calling Methods for Business Services

The example in this topic describes how to call a method for a business service when the user clicks a button.

To call methods for business services

  1. Use a JavaScript editor to open the physical renderer for the applet that you must modify.
  2. Locate the onclick code for the button that you must modify.
  3. Add the following code to the code you located in Step 2:

    var service = SiebelApp.S_App.GetService("business_service_name");
    if (service) {
      var inPropSet = CCFMiscUtil_CreatePropSet();
      //Code occurs here that sets the inPropSet property set with all information that Siebel Open UI must send as input to the method that it calls.
      var ai = {};
      ai.async = true;
      ai.selfbusy = true;
      ai.scope = this;
      ai.mask = true;
      ai.opdecode = true;
      ai.errcb = function(){
          //Code occurs here for the method that Siebel Open UI runs if the AJAX call fails
        };
      ai.cb = function(){
          //Code occurs here for the method that Siebel Open UI runs if the AJAX call is successful
        };
      service.InvokeMethod("method_name", "input_arguments", ai);
    }

    For more information, see InvokeMethod Method for Application Models.

Configuring Siebel Open UI Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.