Configuring Siebel Open UI > Customizing Siebel Open UI for Siebel Mobile Disconnected > Doing General Customization Tasks for Siebel Mobile Disconnected >

Using Custom Siebel Business Services


This topic describes how to call a Siebel business service that you customize. You must configure Siebel Open UI to register this business service before Siebel Open UI can call it.

To use custom Siebel business services

  1. Use a JavaScript editor to create a new JavaScript file.
  2. Register your custom business service. You add the following code:

    var inputObj = {};
    inputObj[oconsts.get("DOUIREG_OBJ_NAME")]= "business_service";
    inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "class";
    SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);

    where:

    • business_service identifies the name of a custom business service.
    • class identifies the JavaScript class that the custom business service references.

      For example:

    if (typeof (SiebelApp.PharmaCallValidatorsvc) === "undefined") {
      SiebelJS.Namespace('SiebelApp.PharmaCallValidatorsvc'); 
     

      var oconsts = SiebelApp.Offlineconstants;
      var inputObj = {};
     
      inputObj[oconsts.get("DOUIREG_OBJ_NAME")]= "LS Pharma Validation Service";
      inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "PharmaCallValidatorsvc";
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
      SiebelApp.PharmaCallValidatorsvc = (function () {

        function PharmaCallValidatorsvc() {
          SiebelApp.PharmaCallValidatorsvc.superclass.constructor.call(this);
        }
        SiebelJS.Extend(PharmaCallValidatorsvc, SiebelApp.ServiceModel);

    For more information about the methods that this step uses, see the following topics:

  3. Use CanInvokeMethod to determine if Siebel Open UI can call your custom business service method.

    For example, the following code determines if Siebel Open UI can call the CallValidate business service method:

    PharmaCallValidatorsvc.prototype.CanInvokeMethod = function (svcMthdName) {
      if (svcMthdName === "CallValidate") {
        $.setReturnValue({err: "", retVal: true});
         return;
      }
      else {
        return SiebelApp.PharmaCallValidatorsvc.superclass.CanInvokeMethod.call(this, svcMthdName);
      }
    };

    For more information about the methods that this step uses, see CanInvokeMethod Method.

  4. Use InvokeMethod to call your custom business service method.

    For example, the following code calls the CallValidate business service method:

        PharmaCallValidatorsvc.prototype.InvokeMethod = function (svcMthdName, psinpargs) {
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
          if (!svcMthdName) {
             $.setReturnValue({err: "", retVal: true});
             return;
          }
          if (svcMthdName === "CallValidate") {
                this.CallValidate(psinpargs);
                $.callback(this,function(retObj){
                psOutArgs = retObj.retVal;
                this.CleanUp();
                $.setReturnValue({err:false,retVal:psOutArgs});
                 return;
                });
              }
          }
          else {
            return SiebelApp.PharmaCallValidatorsvc.superclass.InvokeMethod.call(this, svcMthdName, psinpargs);
          }
         
          PharmaCallValidatorsvc.prototype.CallValidate = function (psinpropset) {
            var psOutArgs = SiebelApp.S_App.NewPropertySet();
            //Some Logic
            $.setReturnValue({err:false,retVal:psOutArgs});
          };
         
        };
      return PharmaCallValidatorsvc;
      } ());
    }

    For more information about the methods that this step uses, see the following topics:

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