Configuring Siebel Open UI > Customizing Siebel Open UI for Siebel Mobile Disconnected > Customizing Siebel Service for Siebel Mobile Disconnected Clients >

Allowing Users to Commit Part Tracker Records


The example in this topic describes how to enable the Commit button so that users can commit a Part Tracker record. To set the Commit Flag for a Part Tracker record, the user navigates to the Activities - Part Tracker view, chooses a Part Tracker record, and then clicks Commit. If the part is:

  • Not already committed, then Siebel Open UI commits the part.
  • Already committed, then Siebel Open UI displays a message that the part is already committed.

To allow users to commit Part Tracker records

  1. In Windows Explorer, navigate to the following folder:

    INSTALL_DIR\eappweb\PUBLIC\language_code\build_number\scripts\siebel\offline

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

  2. Copy the servicecommitpartconsumed.js file to the following folder:

    INSTALL_DIR\eappweb\PUBLIC\language_code\files\custom\

    For more information, see Organizing Files That You Customize.

  3. Use a JavaScript editor to open the file you created in Step 2.
  4. Locate the following code that resides near the beginning of the file:

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

  5. Add the following code immediately after the code that you located in Step 4:

    var inputArgs = {};
      var oconsts = SiebelApp.Offlineconstants;
      inputArgs[oconsts.get("DOUIREG_OBJ_NAME")]= "SHCE Service FS Activity Part Movements List Applet - Mobile";
    inputArgs[oconsts.get("DOUIREG_OBJ_TYPE")]= oconsts.get("DOUIREG_OBJ_TYPEAPPLET");
      inputArgs[oconsts.get("DOUIREG_OBJ_MTHD")]= "CommitPartMvmtClient";
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]= "commitpartconsumed";
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")] = "CommitPartMvmtClient";
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]= null;
        SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);

    This code registers the service. For more information, see ServiceRegistry Method.

  6. Add the following CanInvokeMethod method immediately after the code that you added in Step 5:

    commitpartconsumed.prototype.CanInvokeMethod = function (svcMthdName) {
      if (svcMthdName === "CommitPartMvmtClient") {
        return true;
      }
      else
        return SiebelApp.commitpartconsumed.superclass.CanInvokeMethod.call(
          this,svcMthdName);
    };

    This code determines whether or not Siebel Open UI can call a method in the current context of the business component.

  7. Add the following InvokeMethod method immediately after the code that you added in Step 6:

    commitpartconsumed.prototype.InvokeMethod = function (svcMthdName, psinpargs) {
      var psOutArgs = SiebelApp.S_App.NewPropertySet();
      if (!svcMthdName) {
        return (false);
      }
      if (svcMthdName === "CommitPartMvmtClient") {
          psOutArgs = this.CommitPartMvmtClient();
      }
      else {
          return SiebelApp.commitpartconsumed.superclass.InvokeMethod.call(
            this,svcMthdName, psinpargs);
        }
        return (psOutArgs);
      };

    This code calls the CommitPartMvmtClient service method if the user clicks the Commit button.

  8. Add the following code immediately after the code that you added in Step 7:

    commitpartconsumed.prototype.CommitPartMvmtClient = function () {
      SiebelJS.Log('Invoked CommitPartMvmtClient Method.');
      var pServiceInvBC;
      var cszCommitFlag;
      var pModel;
    pModel = SiebelApp.S_App.Model;
    var pServiceInvBO = pModel.GetBusObject("boName");
    pServiceInvBC = pServiceInvBO.GetBusComp("bcName");
    cszCommitFlag = pServiceInvBC.GetFieldValue("Commit Txn Flag");
    if (cszCommitFlag === 'Y'){
        SiebelJS.Log('Consumed Part Is Already In Committed State');
      }
      else
      {
        // pServiceInvBC.ActivateField("Commit Txn Flag");
        //pServiceInvBC.UpdateRecord();
        pServiceInvBC.SetFieldValue("Commit Txn Flag", "Y", true);
        pServiceInvBC.WriteRecord();
      }
    };

    This code determines whether or not the record is already committed. The DoInvoke method calls the CommitPartMvmtClient method, and then the CommitPartMvmtClient method examines the value of the Commit Txn Flag field. If this value is:

    • Y. Siebel Open UI has already committed the record and displays a Consumed Part Is Already In Committed State message.
    • N. Siebel Open UI has not committed the record and writes the record to the local database.

      For more information about the methods that this code uses, see GetFieldValue Method, SetFieldValue Method, and WriteRecord Method.

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