Obj Methods In Pega
  • Share this blog:

Obj Methods In Pega are as follows

Obj-Browse Method: 

Use the Obj-Browse method to search instances of one class and copy the entire instances, or specified properties, to the clipboard as an array of embedded pages. 

Only properties exposed as columns can be used as selection criteria. However, values of properties that are not exposed as columns, including embedded properties, can be returned.

The Obj-Browse method has the following parameters

-Page Name: Enter the name of the destination page to contain search results. The system uses Code-Pega-List as the class of this page.

-ObjClass: Identify a class to search. You can search one concrete class, or all classes in a class group. Within the PegaRULES database, the class can correspond to a database table or to a database view.

-Max Records: Optional. Enter the maximum number of instances you want returned in the list at runtime. If left blank, the default value is 10,000. 

-GetRowKey: Select to include the primary key in the set of property values returned. Clear to exclude the primary key.

-RowKey: Optional. Leave blank unless the class in the ObjClass parameter corresponds to an external table. Enter the name of a property in the external table, or an expression involving one or more property names, that specifies the unique key of rows of the external table. 

-ReadOnly: Select to mark the embedded pages for the selected instances as read-only, meaning that later processing by the requestor cannot update or delete data in the page. Leave unselected if you plan to update the embedded pages.

-Logic: Optional. Enter a boolean statement that defines how the rows of the parameter array are to be combined. Identify rows by the Label field. You can use the operators AND and OR in this statement, and parentheses for grouping.

-Label: Enter a unique letter or identifier for this row, referenced in the Logic field.

-Select: Select to return the value of this property on each embedded page. In the resulting SQL statement at runtime, this property is listed in the SELECT list

-Field: Enter a property reference. You can specify a Single Value property, a list or group property, or individual elements of a list or group property.

-Condition: Select a comparison, such as Is Equal or Is Less Than.

Select Value Only if the search results are to include the property value, but the property value is not to be used as a selection criterion.

Select Is Null to require that the field a have null value.

Select Is Not Null to require that the field have a value.

If the property is not exposed as a database column, select Value Only.

-Value: Enter a constant value, a property reference or other expression for the comparison. Leave blank if the Condition is Value Only, Is Null, Is Not Null, Is True or Is False.

If you enter an expression involving function rules, Java, and properties on various clipboard pages, then at runtime the expression is evaluated only once.

If you enter a property (that is exposed as a column) that applies to the ObjClass class, the Value value is evaluated for each row.

-Sort: Select No Sorting, Ascending, or Descending to control the sorting of results by this field

The below screen shows the Activity for obj-browse method,

Obj Methods In Pega-obj-browse method

Obj Methods In Pega- clip board of browse method

Obj-Delete Method:

Use the Obj-Delete method to delete a database instance corresponding to a clipboard page and optionally to delete the clipboard page too. You can cause the deletion to occur immediately, or (more commonly) defer deletion until a later execution of a Commit method.

This method can operate on objects of both internal classes (corresponding to rows in a table in the PegaRULES database) and external classes (corresponding to rows in an external relational database).

This method has two parameters:

-Remove: If selected, the system deletes the page identified in the Step Pagecolumn of this step from your clipboard and marks the corresponding persistent instance for deletion

-Immediate: If selected, the system deletes the database instance immediately (commits this deletion).

-To delete the database instance immediately from the database, select this box. If this box is cleared, the database instance is deleted by the next Commit operation.

These situations cause the method status to be Fail or Warn.

-You cannot delete an instance without locking it first (usually with the Obj-Open method).

-You cannot delete an instance while it is locked by another requestor

Obj-Delete-By-Handle Method:

Use the Obj-Delete-by-Handle method to delete an instance identified by its handle. This method executes the operations of the Obj-Open-By-Handle method followed (if successful) the Obj-Delete method.

This method has five parameters:

-InstanceHandle: Enter the handle that identifies the instance to be opened as a literal or a property reference. This corresponds to the value of the pzInsKey property for an internal class, and a simulated handle for an external class.

-Lock: Select to delete the object only if able to acquire a lock. Leave cleared to allow the object to be deleted whether or not a lock can be acquired.

If selected but the class does not allow locking, the Obj-Delete-By-Handle method deletes the instance but produces a warning: Database-LockFailure-NotSupported.

-Release on Commit: Select this box to cause a lock held by your requestor to be released when your changes are completed through the Commit method.

In most cases, select this box if you selected the Lock box. In the unusual case that you want to retain the lock after Commit (perhaps because additional changes are expected), your activity can later use the Page-Unlock method to release the lock.

-LockInfoPage: Optional. As a debugging aid, identify the name of a page to be created by this method to hold the results of the locking attempt when it fails. The page, of class System-Locks, contains the following properties:

pxOwnerID — requestor who holds the lock

pxExpireDateTime — date and time the lock will go soft

pxUpdateOperator — pyUserIdentifier value for the requestor who holds the lock

pxLockHandle — text string that defines the lock

If the Obj-Delete-By-Handle fails to acquire a lock, this page is created and can be viewed with the Clipboard tool or the Tracer.

By convention, this page is named LockInfo in standard rules. When a lock failure occurs during a flow execution, the flow can display the standard harness rule Work-.LockInfo (or a similar harness rule incorporating the standard section rule System-Locks.LockInfo) to report the situation. If the lock not acquired is held by the same user in a separate requestor session, the user can click the  Release Lock    button to relinquish it.

-Immediate: To delete the database instance immediately from the database, select this box. If this box is cleared, the database instance is deleted by the next Commit operation.

Obj-Filter Method:

Use the Obj-Filter method to filter the embedded pages of a results page (such as a Code-Pega-List page produced by the Obj-List, RDB-List, Obj-List-View or Obj-Browse methods) based on one or more when condition rules. 

This method has two required parameters and an array parameter

-Result Class: Select the Applies Tokey part of one or more when condition rules (Rule-Obj-When) to be used to test each result. Must match or be an ancestor class of the class of the embedded pages in the ListPage page.

-When: Complete at least one row of this array, specifying a when condition rule. Enter the second key part (When Name) of a when condition rule. Typically, the comparisons and expressions in the when condition rule involve one or more aggregate properties or unexposed properties.

-ListPage: Name of the results page, of class Code-Pega-List.

The below is an example for the activity containing obj-filter method.

Obj Methods In Pega- obj-filter method

The result for the above activity is shown in the clip board page below.

Obj Methods In Pega- clip board of obj-filter

Obj-ListView Method:

Use the Obj-List-View method to execute the retrieval and sorting operations, but not the formatting and display processing, of a list view rule. 

-ObjClass: Select the Applies To key part of a list view rule. This may identify an internal class or class group, or an external class.

-ListView: Select the Purpose key part of a list view rule

-Owner: Select the Owner key part of a list view rule

The system uses rule resolution to find the list view rule and executes it, but does not produce any HTML output display. The selection criteria of the list view rule and the sorting requirements The database results are organized into a results page of class Code-Pega-List. The name of this page is determined by the Content Page Name field on the Content tab of the List View form, 

obj-listview method

clipboard of obj-listview

Obj-Open Method:

Use the Obj-Open method to open an instance stored in the PegaRULES database or in an external database linked to an external class, and save it as a clipboard page.

This method has four base parameters plus an array of property names and values. 

-OpenClass: Optional. Identify the concrete class of the instance to be opened.

-Lock: Select this box to acquire a lock. Lock the instance if you plan to change and save the instance or delete it.

-ReleaseOnCommit: Select this box if you selected the Lock box and want the system to release the lock when the next Commit method occurs for this instance.

-LockInfoPage: Optional. As a debugging aid, identify the name of a page to be created by this method to hold the results of the locking attempt, when it fails.

-PropertyName: Enter in this array the name of each property or properties and the associated values that together make up the key of the instance to be opened. Type a period before the property name. Enter at least one property name. 

-PropertyValue: For the value, specify either a literal value or a property reference.

obj-open method

clipboard of obj-open method

Obj-Open-By-Handle method:

The handle of an instance is a unique key, in an internal format, assembled by the system that identifies an instance in the PegaRULES database. It may differ from the visible key generally used to identify instances. (Every instance has a unique handle, but more than one instance may share the same visible key.) For rule instances, the handle includes system-generated identifying values (including the create date and time) that make it unique.

Use the Obj-Open-By-Handle method only if you can determine the unique handle that permanently identifies which instance to open. Otherwise, use the Obj-Open method.

Obj-Validate Method:

Use this method to apply a validate rule (Rule-Obj-Validate rule type) for the object identified on the primary page or step page.

This method has two parameters:

-Validate: Enter the second key part of a validate rule to apply.

-Override class: Optional. Enter the name of a class where rule resolution will begin searching for the Validate rule.

The below screen shows an activity with obj-validate method, and the clip board page containing the validation message.

obj-validate method

screen of obj-validate method

clipboard of obj-validate method

At TekSlate, we offer resources that help you in learning various IT courses. 
We avail both written material and demo video tutorials. 
To gain in-depth knowledge and be on par with  practical experience, then explore Pega Training.

Obj-Sort Method:

Use this method to sort the clipboard pages that are the values of a property of mode Page List. You can specify one or more properties to sort on, and whether the sort sequence is ascending or descending for each sort level.

-PageListProperty: Enter a property reference that identifies a target property of mode Page List to be sorted.

-Class: Identify the class of the pages within the Page Listproperty

-SortProperty: Identify in rows of this array a property reference (starting with a period or a page name) on each page of the Page List property that is the basis of sorting. Each property reference most identify a Single Value mode property or a single text string.

-Descending: Select to cause the method to sort in descending order for the property. Clear the box to sort in ascending order

obj-sort method

Obj-Save Method:

Use this method to request that the system save a clipboard page to the PegaRULES database or (if the page belongs to an external class) an external database.

The Obj-Save method uses properties on the page to derive the internal key under which it will be saved. This method can create a new database instance or overwrite a previous instance with that key.

This method has two parameters:

-WriteNow: Normally, leave this box cleared.

Select the box to cause the system to write this page's data to the database as this method executes. If selected, when the activity executes, the system performs an immediate write-through (database commit) of the page to the database.

Clear the WriteNow checkbox in any activity of type Trigger, Utility, Notify, Assign, or Route, and in situations where you want to mark a page to be saved, but want the system to perform the database commit later.

-WithErrors: Select this box if the instance is to be saved even when it contains messages, indicating validation errors.

These situations cause the method status to be Fail or Warn:

-You cannot save a page that is locked by another requestor. 

-You cannot save a page that your session does not hold a lock on (if the page belongs to a lockable class), unless the object is new, never yet saved. 

-You cannot save pages of any class derived from the Code- base class or the Embed- base class. Such pages exist only on the clipboard. 

Obj-Save-Cancel Method:

Use this method to cancel the most recent uncommitted Obj-Save method, so that the instance is not written as part of a later Commit operation. You can also use this method to undo an Obj-Delete that has not yet been committed. 

The page identified in the most recent Obj-Save or Obj-Delete method is removed from the set of pages pending a Commit method. When a later Commit method executes, this page is not included in those committed.

For indepth understanding of Pega click on

About Author
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox