My Oracle Support Banner

Accessing UI Context and Non UI Context Object Instances (Doc ID 477419.1)

Last updated on MAY 13, 2022

Applies to:

Siebel Tools - Version 8.0 [20405] and later
Information in this document applies to any platform.
Area(s):Siebel VB/eScript/COM
Release(s):V7 (Enterprise), V8 (Enterprise)
Database(s):All Supported Databases
App Server OS(s):All Supported Platforms
Latest release tested against:V8 (Enterprise)
Keywords:UI context ActivateField

This document was previously published as Siebel Technical Note 483.

 


Purpose

This document describes how Siebel applications instantiate objects to support the user interface (UI) and how these objects can be accessed from a script to implement business functions. It also describes how objects can be created "out of the UI context" to perform actions that are not immediately reflected in the UI.

A good understanding of the difference between UI and non-UI context objects allows developers to instantiate objects in the right way depending on the business needs.

1.    UI Context objects

UI Context object instances are automatically created and destroyed by the Siebel application to support the rendering of a view.

When a view is displayed in the UI, a business object instance is created in the UI context. Business component instances are created in the UI context for each applet in the view.

All operations performed on a UI context object will be immediately reflected in the UI.

For example:

If bc has been instantiated in the UI context, the following eScript code will perform a requery in the current view and the UI will be affected by the query.

     bc.ClearToQuery();
     bc.ExecuteQuery();

An operation like the example listed below will change the field "Name" in the UI and the user will immediately notice that this field has been updated.

     bc.SetFieldValue ("Name","New Name");

Note: Operations that require the UI to be updated need to be performed using UI-context objects.

1.1.    Accessing UI context objects

Siebel applications provide methods to access UI objects from browser scripts and server scripts. The examples provided in this document assume that the language selected for server scripts is eScript.

To access the business object in the UI context, the following methods are available: Application.ActiveBusObject, Buscomp.BusObject.

Example:

To access a business component in the UI context, the following methods are available: Application.ActiveBusComp, Applet.BusObject, BusObject.GetBusComp.

Example: (code in Account Entry Applet PreInvokeMethod browser event)

(*) ActiveBusComp is only supported in browser script

1.2.    Accessing field values from UI context business components.

In order to access a field using .GetFieldValue method, the field needs to be activated.

In browser scripting, only those fields being displayed in the view are activated. The exception to this rule is ID field which is always active and can be retrieved.

In server scripting, the following fields can be retrieved from a UI-context buscomp:

  • System fields, like Id, Created, Created By
  • Fields exposed in the UI
  • Fields with Force Active property = True
  • Fields with Link Spec property = True

IMPORTANT: Do not use ActivateField method to activate a field in a UI context business component. This may cause some unwanted side effects.

2.    Non-UI Context objects

Non UI context objects are created by code. The instances are non-visual. That is, they have no associated UI components. When a non UI context object is used to perform certain task, the result is not noticed by the user in the current view.

Non UI context business components are used to perform tasks involving other business components that are not shown in the UI.

When the current record is instantiated and modified in the UI context, a warning message appears which indicates that the current record has been modified by either another user or a process running out of the UI context. In order to see the new values of the fields the user may refresh the record by executing a query.

"The selected record has been modified by another user since it was retrieved."

The following examples require the use of a Non-UI Context business component:

2.1.    Accessing Non UI context objects

Non UI context business objects and business components can be created from server scripts using the methods: Application.GetBusObject and BusObject.GetBusComp .

For example:

  	var BO = TheApplication().GetBusObject("Opportunity");
  	var OppBC = BO.GetBusObject("Opportunity");
  	var ActBC = BO.GetBusComp("Action");

GetBusObject is not supported in browser script. However, it is possible to call an applet or buscomp method that has been implemented in server scripting from a browser script.

2.2.    Accessing field values from Non UI context business components

In order to access a field using .GetFieldValue method, the field needs to be activated.

In server scripting, the following fields can be retrieved from a Non UI-context buscomp:

  • System fields, like Id, Created, Created By
  • Fields with Force Active property = True
  • Fields with Link Spec property = True
  • Fields that have been activated in code using ActivateField method

For example:

  var ActBC = BO.GetBusComp("Action");
  ActBC.ClearToQuery();
  ActBC.ActivateField("Status");
  ActBC.ActivateField("Date Modified");
  …
  ActBC.ExecuteQuery();
  If (ActBC.FirstRecord())
  {
     var sStatus = ActBC.GetFieldValue("Status");
  …
  }

IMPORTANT : Use ActivateField method BEFORE executing a query or creating a new record using NewRecord. DO NOT use ActivateField AFTER executing the query or after a NewRecord.


<Attachment 477419.1:5>

Scope

This document is informational and intended for any user.

Details

To view full details, sign in with your My Oracle Support account.

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


In this Document
Purpose
Scope
Details

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.