Configuring Siebel Open UI > Example of Customizing Siebel Open UI > Process of Customizing the Presentation Model >

Customizing Methods in the Presentation Model to Store Field Values


This task is a step in Process of Customizing the Presentation Model.

In this topic, you use the ExecuteMethod method to store the values of the record that the user is attempting to restore from the recycle bin.

Figure 25 illustrates the code you use to customize a method in the presentation model to store the field values of records. Each number in this figure identifies the corresponding step number in the numbered task list that this book includes immediately after this figure.

Figure 25. Customizing a Method in the Presentation Model to Store the Field Values of Records

To customize methods in the presentation model to store field values

  1. In the recyclebinpmodel.js file, add a condition that makes sure Siebel Open UI runs the customization logic only if the user is restoring a record from the recycle bin, and not adding a new record:(

    else if(methodName === "WriteRecord" && this.Get("inRestoration")){

    This if statement examines the value of the methodName in the WriteRecord argument and the value of the inRestoration property. For more information, see WriteRecord Method.

  2. Get the set of records for the recycle bin:

    var recordSet = this.Get("DeletionCompleteSet");

    In Step 10, you configured the DeletionCompletedSet property of the presentation model to store each record that the user adds to the recycle bin.

  3. Get the back up copy of the record that the physical renderer requests to restore:

    var record = recordSet[this.Get("restorationIndex")];

    To get this value, you access the restorationIndex property that you added in Step 6.

  4. Identify the method that Siebel Open UI uses to indicate that the user navigated away from an applet.

    To do this, you can examine Flow That Handles Focus Changes in List Applets. Note that Siebel Open UI calls the LeaveField method as the last step in the flow. This method determines whether or not Siebel Open UI removed the focus from a field in an applet, so Siebel Open UI uses this step in the flow as a flag to signal that it must store the field values. To get information about the methods that the flowcharts describe when you develop your own customization, you can use the descriptions in Siebel Open UI Application Programming Interface.

  5. Get the list of columns that the list applet contains. This list is identical to the list of columns that the DeletionCompleteSet property contains:

    var listOfColumns = this.Get("ListOfColumns");

  6. Get the list of controls that the list applets contains:

    var controls = this.Get("GetControls");

    For more information about the GetControls property, see Properties of the Presentation Model That Siebel Open UI Uses for Applets.

  7. Store the field values:

    for(var i = 0, len = listOfColumns.length; i < len; i++){
      var control = controls[listOfColumns[i].name];
      if(control){
        this.ExecuteMethod("LeaveField", control, record[control.GetFieldName()],
        true);}
      }
    }

    where:

    • The following code iterates through the applet controls that correspond to the list columns of that the record that the DeletionCompleteSet property identifies:

    for(var i = 0, len = listOfColumns.length; i < len; i++)

    • this.ExecuteMethod calls the LeaveField method that you identified in Step 4. It calls this method one time for each iteration. It sends the field value from the corresponding control of the record that DeletionCompleteSet identifies. It sends this value to an argument. When this code iterates, it runs the LeaveField method for every control that Siebel Open UI must populate in the new record that it is using to restore the deleted record from the recycle bin.

      Siebel Open UI must send the LeaveField method as a control and store a value for this control. In this example, it iterates through each control that the list applet contains, and sends the value of the corresponding list column that it uses for the control from the record that the DeletionCompleteSet property gets in Step 2.

      For a description of the arguments that LeaveField uses, Summary of Methods That You Can Use with the Presentation Model for Applets.

    • record stores the field value of the record that Siebel Open UI is restoring. The subsequent WriteRecord call packages and sends these values to the Siebel Server. Siebel Open UI stores these values when it runs the LeaveField method. For more information about this flow, see Flow That Handles Focus Changes in List Applets, .
  8. Save the recyclebinpmodel.js file.
Configuring Siebel Open UI Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.