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 buttons

  1. Use a JavaScript editor to open the plug-in wrapper for the button.

  2. Locate the click handler for the button.

  3. Add the following code to the code that 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 Presentation Models.