Go to primary content
Siebel CRM Configuring Siebel Open UI
Siebel Innovation Pack 2016, Rev. A
E52417-01
  Go to Documentation Home
Home
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
    View PDF

Doing General Customization Tasks for Siebel Mobile Disconnected

This topic describes how to do general customization tasks for Siebel Mobile disconnectedin Siebel Open UI. It includes the following topics:

Modifying Manifest Files for Siebel Mobile Disconnected

The cache manifest file specifies the resources that Siebel Open UI must download to the disconnected client for offline use. Each application uses a separate cache manifest file that uses the following format:

application_name.manifest

where:

  • application_name identifies the name of the Siebel application, such as Siebel Service for Mobile. Siebel Open UI converts this name to lower case and replaces each space that the name contains with an underscore. For example, siebel_service_for_mobile.manifest is the cache manifest file that Siebel Open UI uses for Siebel Service for Siebel Mobile disconnected.

Manifest files reside in the following folder on the Mobile Web Client:

\SWEApp\PUBLIC\language_code\siebel_service_for_mobile.manifest

Siebel Open UI includes only the cache manifest files that it requires to support the Siebel application that you deploy.

For more information about the language_code, see "Languages That Siebel Open UI Supports".

To modify manifest files for Siebel Mobile disconnected 

  1. Add resources to the cache manifest file that your application uses, as necessary.

    If your deployment requires custom resources to run an application offline, then you must add these resources to the cache manifest file that this application uses. For example, assume you must configure Siebel Open UI to run Siebel Service for Siebel Mobile disconnected so that it can download the following resources, and then use them while the client is offline:

    • my_style.css

    • my_image.png

    • my_script.js

    In this situation, you can create a file named my_cache.manifest that includes the following information:

    CACHE MANIFEST
    # 2012-4-27:v1
    # Explicitly cached 'master entries'.
    CACHE:
    files/my_style.css
    images/my_image.png
    scripts/my_script.js
    

    The cache manifest file must use the HTML 5 standard. This standard allows you to run a Perl script in Step 4 that merges your custom cache manifest files into the predefined application cache manifest files. Siebel Open UI includes this script starting with the Siebel CRM 8.1.1.10 Quick Fix release.

  2. Make a backup copy of the predefined manifest file that you must modify.

    For example, siebel_service_for_mobile.manifest. You modify this file in Step 4.

    It is recommended that you do this backup because the script that you run in this task modifies the siebel_service_for_mobile.manifest file. You can use this backup if you encounter a problem when running this script.

  3. Open a Windows command line on the computer where the manifest files reside, and then navigate to the following folder:

    \SWEApp\PUBLIC\language_code\
    

    The SWEApp folder resides on the Mobile Web Client. If you are doing this task on the Siebel Server, then navigate to the following folder:

    \<Install_Dir>\eappweb\PUBLIC\language_code
    
  4. Enter the following command:

    Perl mergemanifest.pl -s my_cache.manifest-d application_name.manifest
    

    where:

    • my_cache.manifest specifies the source manifest file. If you do not include the -s switch, then Siebel Open UI uses the custom.manifest file, by default.

    • application_name.manifest specifies the destination manifest file. You must include the -d switch.

    For example:

    Perl mergemanifest.pl -s my_cache.manifest -d siebel_service_for_mobile.manifest
    

    This command merges the custom manifest file that you modified in Step 1 into the predefined siebel_service_for_mobile.manifest file. Note the following:

    • You must run this script any time you modify your cache manifest file or do an upgrade.

    • You must make sure the source and destination files exist.

    • This script adds the CACHE, NETWORK, and FALLBACK sections that reside in the my_cache.manifest, if they exist, to the end of the corresponding sections that reside in the siebel_service_for_mobile.manifest file. Your custom entries take precedence over the predefined Oracle entries that reside in this file.

    • If a file contains more than one CACHE section, NETWORK section, or FALLBACK section, then this script merges these sections into one section. For example, if two CACHE sections exist, then this script merges these CACHE sections into a single CACHE section. This merge does not modify the sequence where the entries reside in the files.

    • The script does not add duplicate entries to the destination file. If the merge results in duplicate entries, then Siebel Open UI removes the first duplicate from the destination file. It adds this removed entry to the destination.log file that resides in the folder where the destination file resides.

    • The script does not include empty lines in the destination file.

    • This script creates the destination.log file every time it runs.

    • If the script finishes the merge, and if the result of this merge is identical to the destination file, then the script does not update the destination file, and the destination file retains its original timestamp.

Registering Methods to Make Sure Siebel Open UI Runs Them in the Correct Sequence

Siebel Mobile disconnected uses a local database, which is a database that resides in the browser that stores the data that Siebel Open UI requires.

To register methods to make sure Siebel Open UI runs them in the correct sequence 

  1. On the client computer, use a JavaScript editor to open the file that includes the business service call that you must modify.

    For more information, see "Using Custom JavaScript Methods".

  2. Locate the code that includes the business service call that you must modify.

  3. You can use the ExecuteQuery and FirstRecord methods. Assume you locate the following code in Step 2:

    business_service.prototype.Submit = function () {
      retObj = bc.ExecuteQuery();
      err = retObj.err;
      if(!err){
        retObj = bc.FirstRecord();
        if(!retObj.err){
          //Do an operation here that sets the return value to bRet
          return({err:false,retVal:bRet});
        }
      }
      else{
        SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
        return({err:true});
      }
    };
    
    • where business_service identifies the name of the business service that your custom code calls. For example, PharmaCallSubmitsvc.

    For more information, see "SetErrorMsg Method", "FirstRecord Method" and "ExecuteQuery Method".

    In this example, you replace the code that you located in Step 2 with the following code:

    PharmaCallSubmitsvc.prototype.Submit = function () {
      var currRetValue={err:false}, retObj;
      retObj=bc.ExecuteQuery();
        err = retObj.err;
        if(!err){
          retObj=bc.FirstRecord();
            if(!retObj.err){
              //Do an operation here that sets the return value to bRet
              currRetValue={err:false,retVal:bRet};
            }
          }
        else{
          SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
          currRetValue={err:true};
        }
      return currRetValue;
    };
    

Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects

This topic describes how to use a Siebel business service or a JavaScript service to customize a predefined, Siebel CRM applet or business component.

Customizing Predefined Business Components

The example in this topic describes how to register and call a custom JavaScript method that customizes a predefined business component. You must configure Siebel Open UI to register a custom method before Siebel Open UI can call it.

To customize predefined business components 

  1. Use a JavaScript editor to create a new JavaScript file.

  2. Specify the input properties that Siebel Open UI must send to the ServiceRegistry method.

    The ServiceRegistry method uses input properties to register your custom method. For more information, see "Properties You Must Include to Register Custom Business Services".

    You add the following code:

    1. Create the namespace for the JavaScript class. In this example, you create a namespace for the pharmacallsvc class:

      if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
        SiebelJS.Namespace('SiebelApp.pharmacallsvc');
      
    2. Define the variables:

      var oconsts = SiebelApp.Offlineconstants;
      var inputObj = {};
      
    3. Specify the business component where Siebel Open UI applies your customization. In this example, you specify the Pharma Professional Call - Mobile business component:

      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";
      
    4. Specify the type of object that you are customizing. In this example, you are customizing a business component:

      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");
      
    5. Specify the name of the predefined method that you are customizing. In this example, you are customizing the WriteRecord method:

      inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";
      
    6. Specify the name of the JavaScript class where the method you are customizing resides. In this example, this method resides in the pharmacallsvc class:

      inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
      
    7. Specify the name of the custom service method that contains the customization of the WriteRecord method:

      inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";
      
    8. Specify the type of customization:

      inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
      
  3. Register the custom JavaScript method that you specified in Step 2. This code calls the ServiceRegistry method:

    SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
    
  4. Define the constructor:

    SiebelApp.pharmacallsvc = (function () {
    function pharmacallsvc() {
    }
    
  5. Extend the custom JavaScript class:

    SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
    
  6. Specify the custom WriteRecord method:

    pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs
    var psOutArgs = SiebelApp.S_App.NewPropertySet();
    return psOutArgs;//return the outputs
    };
    return pharmacallsvc;
    } ());
    }
    

    The custom method must include your customization logic. This code gets the property set from the predefined WriteRecord method and uses it as input to your custom WriteRecord method. The custom WriteRecord method then returns an output property set to the predefined WriteRecord method.

    The following code is the completed code for this topic:

    if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
      SiebelJS.Namespace('SiebelApp.pharmacallsvc');
      var oconsts = SiebelApp.Offlineconstants;
      var inputObj = {};
      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Professional Call - Mobile";
      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEBUSCOMP");
      inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "WriteRecord";
      inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
      inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "WriteRecord";
      inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
      SiebelApp.pharmacallsvc = (function () {
      function pharmacallsvc() {
        }
        SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
        pharmacallsvc.prototype.WriteRecord = function (psInputArgs) {//get the inputs
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
        return psOutArgs;//return the outputs
      };
      return pharmacallsvc;
      } ());
    }
    
  7. If you want Siebel Open UI to anonymously register existing applet and business component objects you can use anonymous registration. This allows administrators to have a common customization across all applets or all business components.

    For example, in order to have the ability to print or click on a specific button in any applet, the following registration will give the handle of invoke a method in any applet, because the ObjectName is deliberately omitted:

    inputArgs[oconsts.get("DOUIREG_OBJ_NAME")] = "";
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]=oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
    inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";
    inputArgs[oconsts.get("DOUIREG_SRVC_NAME")] = "CustomDMService";
    inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethodPrint";
    inputArgs[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
    

    In this case, InvokeMethodPrint will be called for all applets as PRE whenever InvokeMethod is called for any applet.

Customizing Predefined Applets

The example in this topic registers a custom method that customizes a predefined applet. The work you do in this topic is very similar to the work you do in "Customizing Predefined Business Components". The only difference occurs when you specify the input object for the applet and the type of object.

To customize predefined applets 

  • Do Step 1 through Step 6 with the following differences:

    • For Step 2c, specify the applet where Siebel Open UI applies your customization. In this example, you specify the Pharma Call Entry Mobile applet:

      inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
      
    • For Step 2d, specify the type of object that you are customizing. You specify an applet instead of a business component:

      inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
      

The following code is the completed code for this topic:

if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
  SiebelJS.Namespace('SiebelApp.pharmacallsvc');
  var oconsts = SiebelApp.Offlineconstants;
  var inputObj = {};
  inputObj [oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
  inputObj [oconsts.get("DOUIREG_OBJ_TYPE")] =   oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
  inputObj [oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";
  inputObj [oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
  inputObj [oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethod";
  inputObj [oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
  SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
  SiebelApp.pharmacallsvc = (function () {
  function pharmacallsvc() {
    }
    SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel);
    pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {//get the inputs
      var psOutArgs = SiebelApp.S_App.NewPropertySet();
    return psOutArgs;//return the outputs
  };
  return pharmacallsvc;
  } ());
}

Using Custom JavaScript Methods

The example in this topic describes how to call a custom JavaScript method that does not customize a predefined method. Siebel Open UI does not require you to register a custom JavaScript method. Instead, you configure Siebel Open UI to do the following work:

  • Override the InvokeMethod to call your custom method.

  • Override the CanInvokeMethod method to enable or disable your custom method.

The offline_predefined_js_call_example.js file contains the code that this example describes. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support.

To use custom JavaScript methods 

  1. Use a JavaScript editor to create a new JavaScript file.

  2. Register the InvokeMethod and CanInvokeMethod methods. You add the following code:

    if (typeof (SiebelApp.pharmacallsvc) === "undefined") {
      SiebelJS.Namespace('SiebelApp.pharmacallsvc');
      var inputObj = {};
      var oconsts = SiebelApp.Offlineconstants;
      inputObj[oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
      inputObj[oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
      inputObj[oconsts.get("DOUIREG_OBJ_MTHD")] = "CanInvokeMethod";
      inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
      inputObj[oconsts.get("DOUIREG_SRVC_MTDH")] = "CanInvokeMethod";
      inputObj[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
      inputObj[oconsts.get("DOUIREG_OBJ_NAME")] = "Pharma Call Entry Mobile";
      inputObj[oconsts.get("DOUIREG_OBJ_TYPE")] = oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
      inputObj[oconsts.get("DOUIREG_OBJ_MTHD")] = "InvokeMethod";
      inputObj[oconsts.get("DOUIREG_SRVC_NAME")] = "pharmacallsvc";
      inputObj[oconsts.get("DOUIREG_SRVC_MTDH")] = "InvokeMethod";
      inputObj[oconsts.get("DOUIREG_EXT_TYPE")] = oconsts.get("DOUIREG_EXT_TYPEPRE");
      SiebelApp.S_App.GetModel().ServiceRegistry(inputObj);
      SiebelApp.pharmacallsvc = (function () {
        function pharmacallsvc(pm) {
        }
        SiebelJS.Extend(pharmacallsvc, SiebelApp.ServiceModel); //Extending
        pharmacallsvc.prototype.InvokeMethod = function (psInputArgs) {
          var svcMthdName = "";
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
    

    For more information about this code, see the description about the inputObj argument in "ServiceRegistry Method". Also see "CanInvokeMethod Method" and "Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects".

  3. Get the value of the MethodName argument from the psInputArgs method:

    svcMthdName = psInputArgs.GetProperty("MethodName").toString();
    
  4. Call the Submit method:

    if (svcMthdName === "Submit") {
      retObj=this.Submit();
    
  5. Do one of the following:

    • If InvokeMethod handles the submit call that you define in 4, then you use the following code to set the Invoked property to true:

          if (!retObj.err) {
            psOutArgs.SetProperty("Invoked", true);
            currRetValue=({err: "", retVal: psOutArgs});
          }
          else {
            psOutArgs.SetProperty("Invoked", true);
            currRetValue=({err: retObj.err, retVal: psOutArgs});
          }
        });
      return currRetValue;}
      
    • If InvokeMethod does not handle the submit call that you define in Step 4, then you must use the following code to configure Siebel Open UI to set the Invoked property to false. This code is required for any InvokeMethod method that you configure Siebel Open UI to override:

        else {
          psOutArgs.SetProperty("Invoked", false);
          currRetValue=({err: "", retVal: psOutArgs});
        }
        return(currRetValue);
      };
      
    • If the current, overridden CanInvokeMethod method handles the submit call that you define in Step 4, then you must set the Invoked property to true. Siebel Open UI includes the return value in the RetVal property for the method from CanInvokeMethod. You can set this method according to your requirements:

      pharmacallsvc.prototype.CanInvokeMethod = function (psInputArgs) {
        var currRetValue={err:false}, retObj;
        var psOutArgs = SiebelApp.S_App.NewPropertySet();
        var svcMthdName = "";
        svcMthdName = psInputArgs.GetProperty("MethodName").toString();
        if (svcMthdName === "Submit") {
          psOutArgs.SetProperty("Invoked", true);
          psOutArgs.SetProperty("RetVal", true);
          currRetValue=({err: "", retVal: psOutArgs});
        }
      
  6. If the current, overridden CanInvokeMethod method does not handle the submit call, then use the following code to set the Invoked property to false:

        else {
          psOutArgs.SetProperty("Invoked", false);
          psOutArgs.SetProperty("RetVal", false);
          currRetValue=({err: "", retVal: psOutArgs});
        }
        return(currRetValue);
      };
     pharmacallsvc.prototype.Submit= function (psInputArgs) {
        var psOutArgs = SiebelApp.S_App.NewPropertySet();
        return(psOutArgs);
      };
      return pharmacallsvc;
    } ());
    

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) {
      var currRetValue={err:false}, retObj;
     if (svcMthdName === "CallValidate") {
        currRetValue={ err: false, retVal: true };
        return currRetValue;
      }
      else {
        return SiebelApp.PharmaCallValidatorsvc.superclass.CanInvokeMethod.call(this, svcMthdName);
      }
    };
    

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

  4. Depending on whether you want to make a call from service to service, or to a standalone service, use one of the following methods:

    1. To make a call from one service to another service, use InvokeMethod. This method will call your custom business service method.

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

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

      The call from any other service file must be done as follows:

      var service = SiebelApp.S_App.GetService("LS Pharma Validation Service");var outputSet = service.Invoke("CallValidate", psPropertySet);
      
    2. To make a call to a standalone service use the InvokeMethod method. Use the Client- Service Call method to customize the disconnected mobile client. This allows a service call to be made from the client, typically from a physical model.

      For example, the following code enables you to display the total number of products detailed in the tooltip. This would be the call from the physical model:

      var service = SiebelApp.S_App.GetService("LS Pharma Validation Service");
      var inPropSet = SiebelApp.S_App.NewPropertySet();
      if (service) {
               retObj=currRetValue=service.InvokeMethod("CountPDMethod", inPropSet);
               var outPropSet = retObj.retVal;
      }
      

      In online mode, the call is to the standalone business service in a server, whereas in offline mode, this invokes the standalone offline business service code.

      For example, the following code is for the Sample Offline service:

      PharmaCallValidatorsvc.prototype.CanInvokeMethod = function (svcMthdName) {
               var currRetValue={err:false}, retObj;
               if (svcMthdName === " CountPDMethod") {
                     currRetValue={ err: false, retVal: true };
                     return currRetValue;
                  }
                  else {
                     return SiebelApp.PharmaCallValidatorsvc.superclass.CanInvokeMethod.call(this,  svcMthdName);
                  }
               };
            PharmaCallValidatorsvc.prototype.InvokeMethod = function (svcMthdName, Inputs) {
               var currRetValue={err:false}, retObj;
               var psOutArgs = CCFMiscUtil_CreatePropSet();
               if (svcMthdName === " CountPDMethod") {
                  var BO = SiebelApp.S_App.GetBusObject("Pharma Professional Call - Mobile");
                  var PDBC = BO.GetBusComp("Pharma Call Products Detailed");
                  PDBC.SetSearchExpr( "[Activity Id] = '" + Inputs.GetProperty("Id") + "'";);
                  retObj=currRetValue=PDBC.ExecuteQuery();
                  retObj=currRetValue=PDBC.FirstRecord();
                  var result = PDBC.CountRecords();
                  Outputs.SetProperty("OutputText",result);
               }
      

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

Configuring Data Filters

It is recommended that you configure filters to reduce the amount of business component data that Siebel Open UI must download to do offline operations. Siebel Open UI comes predefined with a number of data filters. You can modify these filters. For more information about how to modify them, see the chapter about working with data filters in Siebel Mobile Guide: Disconnected.

Configuring Objects That Siebel Open UI Does Not Display in Clients

The Handheld Business Service only downloads fields, business component data, and business object data that Siebel Open UI displays in the client. You must configure Siebel Open UI to download these objects that it does not display in the client. To do this, you use the Settings tab of the Mobile Application view in the Administration - Siebel Remote screen in the administrative client. For more information, see the topic that describes configuring application settings in Siebel Mobile Guide: Disconnected.

Configuring Error Messages for Disconnected Clients

This topic describes how to configure Siebel Open UI to use the SetErrorMsg method in your custom code to return and display a custom error message in a disconnected client.

To configure error messages for disconnected clients 

  1. Use an editor to open the file that calls a custom applet, business component, or business service.

    This is the same file that you create in "Using Siebel Business Services or JavaScript Services to Customize Siebel CRM Objects".

  2. Locate the code that might return an error message.

    For example, assume your deployment includes the following code, and that this code calls a method that might return an error message:

    BusComp.prototype.Caller = function ()
     var currRetValue={err:false}, retObj;
      retObj=currRetValue=this.Called();
    

    In this example, the Called method might return an error message. It calls the Caller method. These methods might reside in different locations in a production environment.

  3. Add the following code to the code that you located in Step 2:

        //Check for any errors
        if(retObj.err){
          currRetValue=retObj;
        }
        else{
          //Positive case
          currRetValue={err:false,retVal:false};
        }
      });
      return currRetValue;
    }
    

    This code determines whether or not the Called method returns an error message. If it:

    • Returns an error message, then this code calls the return value to some error.

    • Does not return an error message, then the following code sets the err return value to null:

      currRetValue={err:false,retVal :false};

  4. Add the following code to the code that you located in Step 3:

    BusComp.prototype.Called = function (){
      var currRetValue={err:false}, retObj;
      var errParamArray = [];
      errParamArray.push(value1, valueN);
    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("messageKey", errParamArray);
    currRetValue={err:"AppropriateErrorCode",retVal:false};
    

    where:

    • value1 is a property that Siebel Open UI sends to the SetErrorMsg method. You can configure Siebel Open UI to send up to eight properties.

    • messageKey is a key that Siebel Open UI maps to the message string that it displays.

    For more information, see "SetErrorMsg Method".

    In this example, the following code calls the SetErrorMsg method:

    SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("AppropriateErrorCode", errParamArray);
    

    The following code makes sure Siebel Open UI returns an err value. This value contains the error code:

    currRetValue = {err:"AppropriateErrorCode",retVal:false};
    return currRetValue;
    

The following code is the completed code that this example uses:

BusComp.prototype.Caller = function ()
  var currRetValue={err:false}, retObj;
  retObj=currRetValue=this.Called();
    //Check for any errors
    if(retObj.err){
      currRetValue=(retObj);
    }
    else{
      //Positive case
      currRetValue={err:false,retVal :false};
    }
  return currRetValue;
}
BusComp.prototype.Called = function (){
  var currRetValue={err:false}, retObj;
  var errParamArray = [];
  errParamArray.push(fieldName);
  SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("ErrorCode",   errParamArray);
  currRetValue={err:"AppropriateErrorCode",retVal:false};
  return currRetValue;
}

where:

  • ErrorCode identifies a messageKey. Siebel Open UI gets the message text for the message key from the swemessages_language_code.js file that resides in an local folder. For example, swemessages_enu.js. For more information about the language_code, see "Languages That Siebel Open UI Supports".

  • fieldName identifies the name of a business component field. This field contains the values that Siebel Open UI displays in the error message. For example, the predefined BCErrNoSuchField message key includes the following message text in the swemessages_enu.js file:

    "Field '%1' not found in BusComp."
    

SetErrorMsg replaces %1 with the value that Siebel Open UI passes in the errParamArray. For example:

errParamArray.push("Name");
SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("BCErrNoSuchField",errParamArray)

In this example, Siebel Open UI replaces "%1" with the value Name:

"Field 'Name' not found in BusComp."

About Siebel Mobile Application Logging

Users can enable logging for Siebel Mobile applications on their devices. For information about Siebel Mobile Application logging, see Siebel Mobile Guide: Disconnected.