Reverting The Changes From PM File Resulting In UndoRecord Error

(Doc ID 2419135.1)

Last updated on JULY 04, 2018

Applies to:

Siebel CRM - Version 16.19 [IP2016] and later
Information in this document applies to any platform.

Symptoms

On : 16.19 [IP2016] version, Field Service

Custom logic is implemented to identify duplicate records: (i.e) when First Name + Last Name matches then a pop-up or warning message will get popped up, and then a pop-up applet will be opened to show the duplicates.
The logic works perfectly if the user tabs out of the field and clicks on CTRL+S.
However, if the user does some changes and if the cursor is on the same field where the value is edited, then an error is thrown "Method UndoRecord is not Allowed Here".

ERROR
-----------------------
Method UndoRecord is not Allowed Here

STEPS
-----------------------
The issue can be reproduced at will with the following steps:
1. Implement PM with code:

Applet: Contact List Applet
JS: TestUndoPM.js

CODE:

if (typeof(SiebelAppFacade.TestUndoPM) === "undefined") {

  SiebelJS.Namespace("SiebelAppFacade.TestUndoPM");
  define("siebel/custom/TestUndoPM", ["siebel/listpmodel"],
      function() {
          SiebelAppFacade.TestUndoPM = (function() {

              function TestUndoPM(pm) {
                  SiebelAppFacade.TestUndoPM.superclass.constructor.apply(this, arguments);
              }

              SiebelJS.Extend(TestUndoPM, SiebelAppFacade.ListPresentationModel);

              TestUndoPM.prototype.Init = function() {
                  // Init is called each time the object is initialised.
                  // Add code here that should happen before default processing
                  SiebelAppFacade.TestUndoPM.superclass.Init.apply(this, arguments);
                  SiebelJS.Log(this.Get("GetName") + ": TestUndoPM:      Init method reached.");
                  // Add code here that should happen after default processing

                  this.AddMethod("InvokeMethod", PreInvokeProcess, {
                      sequence: true,
                      scope: this
                  }); //pre handler
              }

              TestUndoPM.prototype.Setup = function(propSet) {
                  // Setup is called each time the object is initialised.
                  // Add code here that should happen before default processing
                  SiebelJS.Log(this.Get("GetName") + ": TestUndoPM:      Setup method reached.");
                  SiebelAppFacade.TestUndoPM.superclass.Setup.apply(this, arguments);
                  // Add code here that should happen after default processing
              }

              function PreInvokeProcess(methodName, psInputArgs, lp, returnStructure) {

                  var outps = false;

                  if (methodName === "WriteRecord") {

                      var sLastName = theApplication().ActiveApplet().BusComp().GetFieldValue("Last Name");
                      var sFirstName = theApplication().ActiveApplet().BusComp().GetFieldValue("First Name");

                      outps = sLastName == "Aamos" ? true : false;

                      if (sLastName != "" && sFirstName != "") {

                          if (outps) {
                              theApplication().ActiveApplet().InvokeMethod("UndoRecord");
                              // Checked with UndoRecord commented. It will not undo the changes done. So it needs to be added. "CancelOperation" is not enough.
                              SiebelJS.Log("In PreInvokeProcess");
                              returnStructure["CancelOperation"] = true;
                              returnStructure["ReturnValue"] = "";
                              alert("Duplicate Exists");
                              SiebelApp.S_App.uiStatus.Free();

                          }

                      }
                  }
              }

              return TestUndoPM;
          }());
          return "SiebelAppFacade.TestUndoPM";
      })
}




Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms