Presentation Model Methods in Siebel Open UI (Training – Part 8)

You already know how to configure Presentation Model in Siebel Open UI. In this module we will discuss few frequently used Presentation Model Methods in Siebel Open UI that every Open UI developer should know.

Frequently used Presentation Model methods in Siebel Open UI:

  1. Define
  2. Init
  3. AddProperty
  4. SetProperty
  5. Get
  6. ExecuteMethod
  7. AddMethod

1. Define Method:

Siebel Open UI uses ‘Define’ method to locate the Presentation Model (PM) or Physical Renderer (PR) JS file and other dependent files. It must have a return statement like return “SiebelAppFacade.customclassname”;

Syntax: 

define (Module_name,List_of_dependencies,Function);

  • Module_name is the Presentation Model file name with file path but without file extension. 
  • List_of_dependencies is an array of all dependent modules required to execute PM JS file. If there is no dependency, keep it blank. 
  • Function identifies the function name and returns an object. 

Example:

// Define the presentation model file location and other dependencies if any

define(“siebel/custom/ShowHideFieldsPM”, [], function () {
— Write the code here—
return “SiebelAppFacade.ShowHideFieldsPM”;
});

2. Init Method:

Init stands for Initialization. It is used to initialize other methods or objects like AddProperty, AddMethod.

Syntax: Init()

Example:

ShowHideFieldsPM.prototype.Init = function(){
SiebelAppFacade.ShowHideFieldsPM.superclass.Init.call( this );
this.AddProperty(“ShowHideStatus”, “” );
this.AddMethod( “ShowSelection”, SelectionChange, { sequence : false, scope : this } );
};

3. AddProperty Method:

AddProperty method is used to add a property in Presentation Model. You can use ‘Get’ method to fetch the value from the property. AddProperty method returns ‘True’ if the property is created successfully otherwise ‘False’. A subsequent call to this method with the same property name will overwrite the previous value.

Syntax:

this.AddProperty(“propertyName”, propertyValue);

Example:

this.AddProperty(“ShowHideflag”, False);
SiebelJS.Log(this.Get(“ShowHideflag”));

4. SetProperty Method:

SetProperty is used to set the property value, created by AddProperty method. It returns ‘True’ if the property value is set successfully otherwise ‘False’.

Syntax:

SetProperty(property_name, property_value);

Example

this.SetProperty( “ShowHideflag “, true);

5. Get Method:

Get method returns the property value.

Syntax: Get()

Example:

this.AddProperty(“ShowHideflag”, False);
SiebelJS.Log(this.Get(“ShowHideflag”));

6. AddMethod Method:

AddMethod adds vanilla or custom methods to the Presentation Model. You can use ExecuteMethod to run the method that AddMethod adds. It returns ‘True’ if the method is added successfully, otherwise ‘False’.

Syntax:

AddMethod(“MethodName”, MethodDef(argument1, argunemtn2,… argument n), {MethodConfig : value});

   MethodName is the name of the method that Siebel Open UI adds to the Presentation Model

   MethodDef is an argument that helps to call another method

   Argument1/2..N are the arguments that AddMethod passes to the method defined in MethodDef

   MethodConfig can have below values

      ♦ Sequence:

               – Set it to ‘True’ if you want Siebel Open UI to call MethodName before the method that already exists in PM.

               – False if you want Siebel Open UI to call MethodName after it calls the method that already exists in PM.

               – Default value is False.

      ♦ Override:

               – If ‘True’, Siebel Open UI does not call the method that already exists in PM.

               – If ‘False’, Siebel Open UI calls the method that already exist in PM.

      ♦ Scope:

               – It defines the scope of the MethodDef.

Example:

this.AddMethod( “FieldChange”,  OnFieldChange, { sequence : false, scope: this } );

** You can not override any method that already exists in vanilla application by using Override as True.

7. ExecuteMethod Method:

ExecuteMethod is used to execute vanilla and custom methods in PM. ExecuteMethod returns a value from the method if it exists otherwise it returns ‘Undefined’.

Syntax:

this.GetPM().ExecuteMethod(“vanilla/custom method name”, arguments);

Sometimes it is written as this.ExecuteMethod(“vanilla/custom method_name”, arguments);

Example:

var controls = this.Get( “GetControls” );
var control = controls[ “Status” ];
var value = this.ExecuteMethod( “GetFieldValue”, control );

** If the method, specified in ExecuteMethod, is a custom method, then make sure AddMethod is used to add the method before calling ExecuteMethod.

Few less frequently used Presentation Model Methods:

  1. AttachEventHandler Method
  2. AttachNotificationHandler Method
  3. AddComponentCommunication Method
  4. AttachPostProxyExecuteBinding Method
  5. AttachPreProxyExecuteBinding Method
  6. OnControlEvent Method
  7. Setup Method

These are not highly used Presentation Model methods. If you want to know any of these methods, please let us know.

This ends our module on Presentation Model Methods in Siebel Open UI.

If you have any question, please feel free to comment below.

Keep in touch, follow TechOneStop on Facebook / Twitter / LinkedIn / Goolge+.

<< Module 7: Debugging in Siebel Open UI                     Module 9: Physical Renderer Methods >>

Watch our YouTube Video on Presentation Model Configuration:

Physical Renderer Methods in Siebel Open UI (Training - Part 9)
Error: Invoking service 'Context Service', method 'GetRowSetData' at step 'Get Context Row Set' (SBL-BPR-00162) (SBL-DAT-00215)".

5 Comments

  1. Vidya
  2. Kaushik
  3. MJ
  4. Tomal

Leave a Reply