Skip Headers
Siebel CRM Configuring Siebel Open UI
Siebel Innovation Pack 2015
E52417-01
  Go to Documentation Home
Home
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
    View PDF

Customizing Siebel Service for Siebel Mobile Disconnected Clients

This topic includes some examples that describe how to customize Siebel Service in Siebel Open UI for a Siebel Mobile disconnected client. It includes the following information:

For more information about:

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".

Allowing Users to Return Parts

The example in this topic describes how to enable the RMA button so that a user can return a part. To return a part, the user creates a part tracker record, and then clicks the RMA button to create a Return Material Authorization (RMA) record. The work you do to allow a user to return a part is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, calling the CanInvoke method, DoInvoke method, and so on.

You add the code that specifies how to do the RMA return in Step 4 through Step 10. The rma_return.js file contains this code. To get a copy of this file, see Article ID 1494998.1 on My Oracle Support.

To allow users to return parts 

  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. Use a JavaScript editor to open the servicecmtparts.js file.

  3. Add the following code to the InvokeMethod method:

    var model= SiebelApp.S_App.GetModel();
    var pBusObj = model.GetBusObject("boName");
    var pBusComp = pBusObj.GetBusComp("bcName");
    

    This code gets the active business component for the applet that displays the RMA button.

  4. Add the following code. This code declares the objects:

    if (typeof (SiebelApp.commitpartconsumed) === "undefined") {
      SiebelJS.Namespace('SiebelApp.commitpartconsumed');
    
      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")]="CanInvokeMethod";
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="CanInvokeMethod";
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");
      SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
    
      inputArgs={};
    
      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")]="InvokeMethod";
      inputArgs[oconsts.get("DOUIREG_SRVC_NAME")]="commitpartconsumed";
      inputArgs[oconsts.get("DOUIREG_SRVC_MTDH")]="InvokeMethod";
      inputArgs[oconsts.get("DOUIREG_EXT_TYPE")]=oconsts.get("DOUIREG_EXT_TYPEPRE");
    
      SiebelApp.S_App.GetModel().ServiceRegistry(inputArgs);
    
      inputArgs={};
    

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

  5. Add the following code. This code calls the CanInvokeMethod method:

      SiebelApp.commitpartconsumed = (function () {
        function commitpartconsumed(pm) {
        }
        var commitObj = new commitpartconsumed();
        commitpartconsumed.prototype.CanInvokeMethod = function (psInputArgs) {
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
          var svcMthdName = "";
          svcMthdName = psInputArgs.GetProperty("MethodName").toString();
          if (svcMthdName === "CommitPartMvmtClient") {
            psOutArgs.SetProperty("Invoked", true);
            psOutArgs.SetProperty("RetVal", true);
            $.setReturnValue({err:false,retVal:psOutArgs});
          }
    
          else if (svcMthdName === "OrderPartsRMA") {
            psOutArgs.SetProperty("Invoked", true);
            psOutArgs.SetProperty("RetVal", true);
            $.setReturnValue({err:false,retVal:psOutArgs});
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            psOutArgs.SetProperty("RetVal", false);
            $.setReturnValue({err:false,retVal:psOutArgs});
          }
        };
    
  6. Add the following code. This code calls the InvokeMethod method:

        commitpartconsumed.prototype.InvokeMethod = function (psInputArgs) {
          var svcMthdName = "";
          var psOutArgs = SiebelApp.S_App.NewPropertySet();
          svcMthdName = psInputArgs.GetProperty("MethodName").toString();
          if (svcMthdName === "CommitPartMvmtClient") {
            this.CommitPartMvmtClient();
            $.callback(this,function(retObj){
              psOutArgs.SetProperty("Invoked", true);
              $.setReturnValue({err:false,retVal:psOutArgs});
            });
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            $.setReturnValue({err:false,retVal:psOutArgs});
          }
          if (svcMthdName === "OrderPartsRMA") {
            this.OrderPartsRMA();
            $.callback(this,function(retObj){
              psOutArgs.SetProperty("Invoked", true);
              $.setReturnValue({err:false,retVal:psOutArgs});
            });
          }
          else{
            psOutArgs.SetProperty("Invoked", false);
            $.setReturnValue({err:false,retVal:psOutArgs});
          }
        };
      };
    

    For information about the methods that this code uses, see "setReturnValue Method".

  7. Add the code that gets values for the following fields:

    • Product Id

    • Product Name

    • Used Quantity

    • Id

    • Status

    • Asset Number

    • Part Number

    You add the following code:

    commitpartconsumed.prototype.createRMAOrder = function (orderType) {
      var sOrderId;
      var cszOrderId;
      var sAssetNum;
      var sPartNum;
      var sStatus;
      var sProductId;
      var sProductName;
      var sQuantity;
      var sActivityPartMvmtID;
      var pModel;
      var pFSActivityPartsMovementBC;
      var pActionBC;
      var sSR_Id;
      var pServiceRequestBC;
      var pOrderEntry_OrdersBC;
      var pOrderEntry_LineItemBC;
      var errParamArray = [];
      pModel = SiebelApp.S_App.Model;
      var pBusObj = pModel.GetBusObject("boName")
      pFSActivityPartsMovementBC=pBusObj.GetBusComp("bcName");
      $.callback(this,function(retObj){
        sOrderId=retObj.retVal;
        if (utils.IsEmpty(sOrderId)){
          pFSActivityPartsMovementBC.GetFieldValue("");
          var oPsDR_Header:PropertySet = SiebelApp.S_App.NewPropertySet();
          // Cannot use the same property set in GetMultipleFieldValues, must use a different
          // one for the values. The process will not error, but Siebel Open UI will not place
          // the values in the property set.
          var lPS_values:PropertySet = SiebelApp.S_App.NewPropertySet();
          oPsDR_Header.SetProperty("Product Id","");
          oPsDR_Header.SetProperty("Used Quantity","");
          oPsDR_Header.SetProperty("Id","");
          oPsDR_Header.SetProperty("Asset Number","");
          oPsDR_Header.SetProperty("Part Number","");
          $.callback(this,function(retObj){
            sPartNum=retObj.retVal;
            pActionBC = SiebelApp.S_App.GetActiveView().GetActiveApplet().BusComp().ParentBuscomp();
            pActionBC.GetFieldValue("Activity SR Id");
            $.callback(this,function(retObj){
              sSR_Id = retObj.retVal;
              if(sSR_Id==""){
                   //Activity has no associated SR... Hence the operation will be aborted
                SiebelApp.S_App.OfflineErrorObject.SetErrorMsg("IDS_ERR_FS_MISSING_SR", errParamArray);
                $.setReturnValue({err: "IDS_ERR_FS_MISSING_SR", retVal:""});
                return;
              }
            });
          });
        }
      });
    }
    

    For information about the methods that this code uses, see "GetFieldValue Method" and "callback Method".

  8. Add the code that gets the parent business component and the following business components:

    • Service Request

    • Order Entry - Orders

    • Order Entry - Line Items

    This code also determines whether or not a service request is not associated with the activity. If not, then it aborts the operation. You add the following code:

    else{
      pModel = SiebelApp.S_App.Model;
      pServiceRequestBC = pModel.BusObj("Service Request").BusComp("Service Request");
      pOrderEntry_OrdersBC = SiebelApp.S_App.Model.GetBusObj("Service Request").BusComp("Order Entry - Orders");
      pOrderEntry_LineItemBC = pModel.BusObj("Service Request").BusComp("Order Entry - Line Items");
    //CREATE ORDER Header.
      pOrderEntry_OrdersBC.ExecuteQuery();
      $.callback(this,function(retObj){
    
  9. Add the code that creates the Order Header record and sets the field values. For example, for the Order Type field. You add the following code:

    pOrderEntry_OrdersBC.NewRecord(true);
      $.callback(this,function(retObj){
        sLocaleVal = SiebelApp.S_App.Model.GetLovNameVal(orderType, "FS_ORDER_TYPE");
        pOrderEntry_OrdersBC.SetFieldValue("Order Type", sLocaleVal, true);
        $.callback(this,function(retObj){
          pOrderEntry_OrdersBC.WriteRecord();
          $.callback(this,function(retObj){
            pOrderEntry_OrdersBC.GetFieldValue("Id");
            $.callback(this,function(retObj){
              sOrderItemId=retObj.retVal;
              pOrderEntry_OrdersBC.GetFieldValue("Id");
              $.callback(this,function(retObj){
                m_sOrderHeaderId=retObj.retVal;
                pOrderEntry_LineItemBC.ExecuteQuery();
                $.callback(this,function(retObj){
    

    For information about the methods that this code uses, see "SetFieldValue Method", "WriteRecord Method", "NewRecord Method".

  10. Add the code that creates the order line item record, commits this record, and sets the value for the Order Item Id field in the active business component. This value is the row Id of the order header record that Siebel Open UI creates. This code sets the field value for each of the following fields:

    • Product

    • Quantity Requested

    • Asset #

    • Part #

    • Product Status Code

    • Order Header Id

    You add the following code:

    pOrderEntry_LineItemBC.NewRecord(true);
      $.callback(this,function(retObj){
        pOrderEntry_LineItemBC.SetFieldValue("Product  Id",  sProductId,  true);
        $.callback(this,function(retObj){
          pOrderEntry_LineItemBC.SetFieldValue("Product",  sProductName,  true);
            $.callback(this,function(retObj){
              pOrderEntry_LineItemBC.SetFieldValue("Quantity  Requested",  sQuantity,  true);
              $.callback(this,function(retObj){
              if(!utils.IsEmpty(sAssetNum)){
                pOrderEntry_LineItemBC.SetFieldValue("Asset  Number",  sAssetNum,  true);
                $.callback(this,function(retObj){
                });
              }
              if(!utils.IsEmpty(sPartNum)){
                pOrderEntry_LineItemBC.SetFieldValue("Part  Number",  sPartNum,  true);
                $.callback(this,function(retObj){
                });
              }
              if(!utils.IsEmpty(sStatus)){
                pOrderEntry_LineItemBC.SetFieldValue("Product  Status  Code",  sStatus,  true);
              $.callback(this,function(retObj){
              });
              }
              pOrderEntry_LineItemBC.GetFieldValue("Id");
              $.callback(this,function(retObj){
                sOrderItemId=retObj.retVal;
                pOrderEntry_LineItemBC.SetFieldValue("Order  Header  Id",  m_sOrderHeaderId,  true);
                $.callback(this,function(retObj){
                  pOrderEntry_LineItemBC.WriteRecord();
                  $.callback(this,function(retObj){
                    pFSActivityPartsMovementBC.SetFieldValue("Order  Item  Id",  sOrderItemId,  true);
                   $.callback(this,function(retObj){
                      pFSActivityPartsMovementBC.WriteRecord();
                      $.callback(this,function(retObj){
                      });
                    });
                  });
                });
              });
            });
          });
        });
      });
    });
    
  11. Save, and then close the servicecmtparts.js file.

  12. Test your modifications:

    1. Log in to the disconnected client.

    2. Click the Activities tab.

    3. Create an activity, and then click Part Tracker.

    4. Create a part tracker record.

    5. Click the RMA button to create a Return Material Authorization (RMA) record.

    6. Make sure Siebel Open UI creates the RMA record and displays the correct values in the fields of this record, such as the Product Id, Product Name, Used Quantity, Quantity Requested, Asset #, and so on.

Allowing Users to Set the Activity Status

The example in this topic describes how to enable the activity status so that the user can update this status during the service call life cycle. For example, a field service representative can examine an Activity that is set to Dispatched, set this status to Acknowledged to acknowledge that this representative examined the activity, set the status to EnRoute, travel to the customer site, set it to Arrive, set it to In Progress while working on the service call, and then set it to Finish after finishing the service call. Siebel Open UI includes the following status values:

  • Dispatched

  • Acknowledged

  • Declined

  • En Route

  • Arrive

  • In Progress

  • Hold

  • Resume

  • Finish

Siebel Open UI enables and disables the status depending on the current value of the status. For example, if the representative sets the status to Acknowledged, then Siebel Open UI allows the user to choose the EnRoute status and disables all other values.

The work you do to allow a user to set the status is similar to the work you do to allow a user to commit a Part Tracker record. For example, registering the service, and so on. For more information, see "Allowing Users to Commit Part Tracker Records".

To allow users to set the activity status 

  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. Use a JavaScript editor to open the serviceactstat.js file.

  3. Locate the following code:

    serviceactstat.prototype.InvokeSetActStatus=function(psInpArgs,svcMthdName){
      var psOutArgs=SiebelApp.S_App.NewPropertySet();
      if(!psInpArgs){
        return (false);
      }
      if(psInpArgs.propArray.MethodName=="AcceptStatus")
        {psOutArgs=this.SetActivityStatus("Acknowledged");
      }
      else if(psInpArgs.propArray.MethodName=="Start"||psInpArgs.propArray.
        MethodName=="ArrivedStatus"){psOutArgs=this.SetActivityStatus("In
        Progress","ArrivedStatus");
      }
      else if(psInpArgs.propArray.MethodName=="DeclineStatus"){
        psOutArgs=this.SetActivityStatus("Declined");
      }
      else if(psInpArgs.propArray.MethodName=="EnrouteStatus"){
        psOutArgs=this.SetActivityStatus("In Progress");
      }
      else if(psInpArgs.propArray.MethodName=="SuspendStatus"){
        psOutArgs=this.SetActivityStatus("On Hold");
      }
      else if(psInpArgs.propArray.MethodName=="ResumeStatus"){
        psOutArgs=this.SetActivityStatus("In Progress");
      }
      else if(psInpArgs.propArray.MethodName=="End"||psInpArgs.propArray.
        MethodName=="FinishedStatus"){
        psOutArgs = this.SetActivityStatus("Done","FinishedStatus");
      }
    
  4. Add the following code immediately after the code you located in Step 3:

    serviceactstat.prototype.SetActivityStatus=function (pStatus,pDateMethodInv){
      SiebelJS.Log('Service Method SetActivityStatus...');
      var strstatvalue;
      var pickName;
      var pickListDef;
      var pModel;
      var pBusComp;
      pModel= SiebelApp.S_App.GetModel();
      var pBusObj = pModel.GetBusObject("boName");
      pBusComp = pBusObj.GetBusComp("bcName");
      SiebelApp.S_App.GetActiveView().GetActiveApplet().GetControl("Status").GetPickAppl  et();
      $.callback(this,function(retObj){
      pickName = retObj.retVal;
      $.callback(this,function(retObj){
      pickListDef=retObj.retVal;
        pModel=SiebelApp.S_App.Model;
        pModel.GetLovNameVal("Acknowledged", pickListDef.LOVType);
        $.callback(this,function(retObj){
        strstatvalue=retObj.retVal;
      pBusComp.ActivateField("Status");
        $.callback(this,function(retobj){
        pBusComp.SetFieldValue("Status",strstatvalue,true);
        $.callback(this,function(retobj){
        });
        });
        });
        });
        });
      pBusComp.ActivateField("Status");
        $.callback(this,function(retobj){
      pBusComp.SetFieldValue("Status",strstatvalue,true);
        $.callback(this,function(retobj){
        });
        });
      if(pDateMethodInv!="")//Todo - Refine this condition for uninitialized/defined or remove this condition
      {
        var now=new Date();
        if(pDateMethodInv == "ArrivedStatus")
        {
          pBusComp.SetFieldValue("Started",now,true);
          $.callback(this,function(retObj){
          pBusComp.SetFieldValue("Done","",true);
          $.callback(this,function(retObj){
          });
          });
        }
        else if(pDateMethodInv=="FinishedStatus")
        {
          pBusComp.SetFieldValue("Done",now,true);
          $.callback(this,function(retObj){
          pBusComp.SetFieldValue("Percent Complete","100%",true);
          $.callback(this,function(retObj){
          });
          });
        }
      }
      pBusComp.WriteRecord();
    };
    

    For information about the methods that this code uses, see the following:

  5. Test your modifications:

    1. Log in to the disconnected client.

    2. Update the status of an activity.

      Make sure Siebel Open UI displays the correct status activity. For example, if you set the status to Acknowledged, then make sure Siebel Open UI allows you to choose the EnRoute status and disables all other values.