Activity Methods
Activity Methods
Activity Methods
Process Commander stores the values of all aggregate properties and some Single
Value properties in a BLOB column (the Storage Stream) usually in a compressed
form. Such properties cannot support selection in list view and summary view
reports, and can slow retrieval and processing in other operations.
For maximum flexibility, your development team can create new Single Value
properties at any time, without the need to coordinate with a database
administrator. However, exposing properties as distinct columns can significantly
improve performance. You can expose a property even after the property has values,
but additional processing is required to copy values for the new column from the
BLOB value into the new column.
To make changes to the database schema, your connection to the PegaRULES
database must allow certain SQL capabilities. See the notes on Admin Username
fields on the topic Database Name Completing the Database tab.
The Column Inclusion field (on the Advanced tab of the Property form, for Single
Value properties), contains one of four values (blank, Optional, Required, Requested)
that indicates the judgement or opinion of the developer who created or updated the
property. This value is advisory only; it does not affect any runtime behavior of
the property. However, using the Database Class Mappings gadget, you can compare
the values in this field with the current schema, identifying properties marked as
Required which are not exposed.
> Data Model > Classes and Properties > Database Class
Select
> System > Database > Column Population Jobs to monitor the background
processing.
Computations involving the property may produce unpredictable or inconsistent
results until the background processing is complete.
Modify Schema approach
Use the Modify Schema wizard to:
Select
> System > Database > Modify Schema to start the wizard. Click the help button (
) on each form of the wizard for additional details on completing the form.
You can use this facility to copy a single value property from the BLOB column and
"expose" it as a column. This change may affect database performance and
database size, but has no functional effect on activities, the property rule, or other
rules referencing the property.
To modify a table schema with this facility, work at a time when no one else is
using the table. Obtain a database user ID and password that allow you to modify
the database schema, not just the rows in the database. (If your account does not
provide the ability to modify the schema, you can generate the Data Description
Language (DDL) statements that are required to modify the schema.)
When working offline, you can review the contents of the database schema as
initially installed. Locate and open the schema HTM file in the Resource Kit directory
of the Process Commander installation media.
Modify : To view the current schema
1. Select
wizard.
> System > Database > Modify Schema. This opens the Modify Schema
A link containing count of Single Value properties in the class that are marked
as Required in the Column Inclusion field on the Advanced tab on the
property form. Values in this field are advisory only; they do not affect
database operation.
5. To view a list of columns in the table, advance to the View Columns step by
clicking View Columns or clicking the numeric link in the Columns in the table
field. Each row in the list contains the column name, its data type, and column
width in bytes.
6. Click Back to return to the View Table step.
7. To advance to the View Properties step, click a numeric link in the Properties
Set to be Visible column in a class row. This form displays properties that
are exposed, plus others for which exposure is requested; the Column
Visibility value is Required or Recommended).
8. Click Back to return to the View Table step (this skips the View Columns step) or
Close to exit the wizard.
Modify Schema: To expose a top-level Single Value property
1. Go to the View Table step to access the table containing the property of
interest.
2. Locate the class that contains the scalar property to be exposed.
3. Click the number in the Set to be Visible column.
4. The resulting detail window displays the properties already exposed as
columns in gray text at the bottom of the display. Properties that are
candidates to be exposed are shown at the top of the display in black text and
contain empty checkboxes at the beginning of the rows.
5. Check the box for each property to become exposed as a column. For
properties with a Type of Text, Identifier, or Password, you can modify the
column width shown in the Column/Size column. The default width is 64
characters, or the Max Length of the property (if that was defined for the
property). If you change these values, remember to update later the Max
Length values if defined on the Property form.
2. Create Single Value properties in the new class to hold values of the
embedded values.
3. Create a Declare Index rule with the appropriate embedded Page Context
value that copies the embedded values into a new Index- instance.
4. Save the Declare Index rule. It executes immediately, adding and deleting
instances of the new class.
5. Expose database columns corresponding to the Index- class.
6. Reference the Index- properties in the list view rule.
Activity Methods:
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 five base parameters and an optional array of selection
criteria.
Parameter
PageName
Description
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.
MaxRecords
GetRowKey
RowKey
ReadOnly
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.
For example, A AND (B OR C OR (E AND F)).
If you leave this blank, the system assumes the AND operation
applies to all rows of the array.
Label
Enter a unique letter or identifier for this row, referenced in the Logic
field.
Select
Field
Condition
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.
The system uses the specified class and key fields to find and open the object and
place its data into the specified step page. The system searches up the class
hierarchy as appropriate to find the instance. If it finds the specified step page, the
system clears any data that is on it and reuses the page. If no existing page has a
name matching the specified step page, the system creates a new page.
Parameters
This method has four base parameters plus an array of property names and values.
Parameter
OpenClass
Description
Optional. Identify the concrete class of the instance to be opened.
If left blank, the class is obtained from the Pages & Classes tab of
the activity based on the property references in the parameter
array.
You can't open an instance of a class that corresponds to a view
in the PegaRULES database (rather than a table).
Lock
Select this box to acquire a lock. Lock the instance if you plan to
change and save the instance or delete it.
Your session cannot lock the object unless your access role includes
the ability to update objects of the class.
Locking an object from an external class prevents updates by
other requestors in the Process Commander system. Such locking
does not prevent changes to the external database including
changes to a row open and locked in Process Commander by
other systems.
ReleaseonCommi Select this box if you selected the Lock box and want the system to
t
release the lock when the next Commit method occurs for this
instance.
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
If the Obj-Open 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 requested but not acquired is held
by the same Operator ID in a separate requestor session, that user
can click the Release Lock
PropertyName
PropertyValue
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.
Rows of a view (rather than in a table) in the PegaRULES database do not have a
handle. This method cannot be used with classes corresponding to views.
When used on a primary page, this method clears any data on the page and
reuses its name and position in an embedded Page List.
An external class (defined through the Connector and Metadata accelerator) may not
contain one property that can serve as a handle. To support the Obj-Open-by-Handle
method with external classes, Process Commander assembles a substitute string
from the key columns of the table.
Except in rare cases, identify in the Step Page field the name of a page to be
created by this method. If the Step Page field of the step is blank, this method opens
the object into the primary page of the current activity, replacing the current
contents of the primary page and changing the class of the primary page to match
the class of the object. Typically, this is not desirable.
Parameters
This method has four parameters:
Parameter
Description
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.
Because the handle is lengthy and not easily displayed, it is often
easier to identify it by a property reference, rather than attempt to
enter the handle by typing. See How to Capture... below for details.
Lock
Select this box if you plan to change and save or delete the
instance.
Your session cannot lock the object unless your access role includes
the ability to update objects of the class. .
You cannot lock an object unless the Allow Locking? checkbox (on
the Locking tab of the Class form) for the object class is selected.
(If the class is part of a class group, the Allow Locking? checkbox on
the class named for the class group is applicable.)
Locking an object from an external class prevents updates by
other requestors in the Process Commander system. Locking does
not prevent changes to the external database including changes
to the row open in Process Commander by other systems.
ReleaseOnCom
mit
If the object is locked and the lock has not expired, this method has no effect.
If the object is not locked, this method acquires a lock and if necessary
replaces the step page contents with the current value of an object instance.
This is useful if you are not certain whether the contents of the step page are current
or whether your requestor session already holds a lock on the page.
Locking an object from an external class prevents only updates by other Process
Commander requestors. Locking does not prevent changes to the external database
including changes to a row that is open in Process Commander by other
systems.
10
Parameters
This method has two parameters.
Parameter
Description
ReleaseonCommi Select this box if you want the system to release the lock when the
t
next Commit method occurs for this instance.
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
Rollback method:
Use this method to cancel or withdraw any previous uncommitted changes to the
PegaRULES database (and to external databases accessed from an external class)
from the current Thread. All pending Obj-Save and Obj-Delete methods are
cancelled.
Parameters
This method has no parameters.
11
Results
All uncommitted database operations are withdrawn. If an instance is locked and the
ReleaseOnCommit box was selected, the lock is released. Locks on instances where
the ReleaseOnCommit box was not selected are retained.
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.
Use the Page-Validate method not this method to validate all the properties on
a page against the requirements defined in their respective Rule-Obj-Property rule
instances.
A later Page-Clear-Messages method applied to the same page removes the
messages set by this method.
A validate rule (Rule-Obj-Validate rule type) can call edit validate rules (Rule-EditValidate rule type). However, note that the current step page is not the primary
page for evaluation of the edit validate rules.
Parameters
This method has two parameters:
Parameter Description
Validate
Enter the second key part of a validate rule to apply.
OverrideCla Optional. Enter the name of a class where rule resolution will begin
ss
searching for the Validate rule.
If blank, rule resolution begins searching for the validate rule on the
class of the step page. You can override the class of the step page with a
higher or lower class.
Property-Map-DecisionTable method:
Use the Property-Map-DecisionTable method to evaluate a decision table rule and
save the result as the value of a property.
In the Diagram tab of a flow rule, a decision shape (
table rule.
Parameters
This method has three parameters:
Parameter
PropertyName
Description
Optional. Select or enter a target property to contain the
results of the decision table evaluation. Enter a property name
12
AllowMissingPropert If selected, the system attempts to evaluate the rule even when
ies
one or more properties referenced in the rule are not present on
the clipboard.
Results
The system forms a decision table rule key using the second parameter and the
class of the step page or primary page. It uses rule resolution to locate the
appropriate decision table rule to evaluate.
The system then evaluates the decision table rule, in the context of current property
values, and stores the results in the property identified in the PropertyName
parameter.
If you specify a PropertyName property but the decision table rule does not return
any value, the property is set to an empty string value.
Property-Map-DecisionTree method:
Use the Property-Map-DecisionTree method in to evaluate a decision tree rule (RuleDeclare-DecisionTree rule type) and store the result as the value of a property.
In the Diagram tab of a flow rule, the Decision shape (
) can reference a
Description
Optional. Identify a target property to contain the results of the
evaluation. (You can't use a local variable here.)
DecisionTreeName
Enter the name second key part of a decision tree rule. The
system uses the class of the step page (or primary page) as the
Applies To key part.
Input
13
When provided, this value is used for comparisons in the toplevel structure of the true, for evaluations with no left-hand
value, such as:
if > "Hello"
When you leave this blank, the system uses the value of the
Property field on the Input tab of the Decision Tree form for the
rule.
AllowMissingPropert Select to cause decision tree processing to continue even if a
ies
referenced property is not present on the clipboard. For a Single
Value property, the system uses the null string as the value of
the missing property.
Clear to cause Decision Tree processing to halt if processing
references a property that is not present on the clipboard. This
causes the system to store an output parameter
DecisionTreeStatus with value "NotFound" on the parameter
page of the activity.
Results
The system forms a decision tree rule key using the second parameter and the class
of the step page or primary page. It uses rule resolution to locate the decision tree
rule to be evaluated.
It then takes as input to the decision tree evaluation either the value of the third
parameter, or the value of the Property field on the Input tab of the decision tree
rule. It evaluates the decision tree in the context of this input value and the current
clipboard.
It stores the results in the property you identify in the first parameter. Typically, the
flow referencing this decision tree chooses which connector to follow from the
decision shape based on this property value.
Property-Map-Value method:
The Property-Map-Value method evaluates a one-dimensional map value (Rule-ObjMapValue rule type) defined in the parameter. The method sets the result as a value
for a Single Value property.
The related method Property-Map-ValuePair works similarly for two-dimensional map
values.
In the Diagram tab of a flow rule, a decision shape (
value rule.
14
Parameters
This method has three parameters:
Parameter
PropertyName
Description
Identify a target property to hold the result of this method. (You
can't use a local variable here.)
MapName
Enter the name second key part of a map value rule (RuleObj-MapValue rule type).
RowInput
value rule.
Parameters
This method has five parameters:
Parameter
PropertyName
Description
Identify a target property to receive the result of this method.
(You can't use a local variable here.)
15
MapName
Enter the name second key part of a map value rule (RuleObj-MapValue rule type)
RowInput
ColumnInput
How long the entry is to remain in the queue before the agent can try to
process it the first time.
16
Step Page
Optional. Identify in the step page for this method (or for a step that calls the
standard activity @baseclass.QueueForAgent) the class of the work item or other
item that is to be processed. This page is available later as context to the agent
activity processing the item. For example:
If the queued item refers to a work item, set the step page to the work page
(typically pyWorkPage).
If the queued item is an assignment, set the step page to the assignment
page (typically NewAssignPage)
If the Step Page value in the step is blank, the primary page of the calling
activity is used.
Parameters
This method has four parameters:
Parameter
AgentRuleSet
Description
The name of the agents rule of the agent that is to process
the queue entry. (The name of an agents rule matches the
name of a RuleSet.)
AgentName
MaxAttempts
17
Deferred
Results
The system creates an entry in the pr_sys_queues database table as an instance of
the System-Queue-DefaultEntry class. This occurs immediately, or upon the next
Commit method execution, depending on the Deferred parameter setting.
The item remains in the queue until processed by an agent.
Flow-End method:
Use this method to immediately end a flow execution, before execution reaches a
Flow-End shape.
This method is needed only in unusual situations. Design flows so that flow
processing ends at a Flow-End shape.
Parameters
This method has no parameters.
Results
The flow rule is no longer associated with the primary page of the activity.
This method does not perform any database updates. As appropriate, design your
activity to clean up assignments or other objects created by the incomplete flow
execution.
Flow-New method:
Use this instruction to start a new flow execution of a flow rule.
To start and complete an additional flow execution for a work item already open,
call the standard activity Work-.StartNewFlow in your activity rather than this
method. This activity locks the work item, adds and runs the identified flow
completely, and then commits changes.
To start an additional flow execution for a work item that is already locked, call
the standard activity Work-.StartFlow in your activity rather than this method. This
adds a flow execution but does not commit.
Parameters
Type Flow-New in the Method field, followed by one space and a flow name (the
second key part of a Rule-Obj-Flow rule) as a literal constant.
18
Usually, this instruction associates the primary page of the activity with the flow
instance, and the Step Page field is left blank.
If the Step Page field is not blank, it may contain a reference to a top-level clipboard
page, or a reference to an embedded page of the work item, such as embedded
page .pyWorkParty(zzz). The latter is known as an interest page.
This instruction has no other parameters.
Results
This instruction can lead to the creation of one or more new work items,
assignments, or other objects on the clipboard. It also performs the equivalent of the
Obj-Save method on these objects, but not a Commit method.
When you create a custom activity that uses the Flow-New method, make sure
that the Commit method occurs at the appropriate time in the activity (or in a later
activity) so the new work item, assignment, and other objects are saved.
Obj-Set-Tickets method:
Use this method in an activity to set (turn on) one or more tickets, or reset (turn off)
one or more tickets.
As a best practice to simplify your application, call the standard activity
Work-.SetTicket from your activity rather than reference this method. That activity
sets and later resets a single ticket, identified in an activity parameter.
Your application must reset the tickets that it sets to prevent possibly indefinite
looping behavior when work items are later resolved. Design your activity or
processing sequence to call the Obj-Set-Tickets twice; once to set the ticket and
later to reset the same ticket.
For a flow rule edited in Process Modeler, tickets may be referenced in the Properties
panel, Ticket tab. For a flow rule edited in Visio, tickets in a flow rule are identified
by the
shape.
Each ticket can identify a ticket rule. Tickets act as a type of event or condition.
Setting a ticket is similar to "raising" an event or performing a GOTO statement in
some programming environments.
When a ticket is set, processing of any currently executing flows that reference that
ticket (subject to rule resolution) is paused. Flows not started, and flows started in
the future, are not affected. Flow processing resumes at the ticket location.
19
A shape in a flow can require that two (or more) tickets to be set before control
resumes at that shape.
Parameters
This method has two parameters:
Parameter
SetTicketNames
Description
Optional. Identify one or more ticket names, typically the
second key part of an instance of the Rule-Obj-Ticket rule type.
This ticket becomes "raised" or activated when this method
executes, immediately affecting the processing of any flow (of
appropriate Work- class) that contains a ticket of that name.
RemoveTicketNam
es
Debugging aid
As a debugging aid, the standard HTML rule @baseclass.DeferredOps interrogates
system internals and presents an ordered list of deferred (uncommitted) database
operations for the current Thread. Your activity can display this HTML rule using the
Show-Page method.
Results
When a ticket is raised (set) through this method, the system searches through all
flows on the step page (not only through the flow that contains the activity that
contains the method.)
This interrupts processing in every flow execution that references that ticket by
name. Flow execution resumes under certain conditions at the shape on the diagram
that references the ticket.
Show-HTML method:
Use the Show-HTML method to cause the activity to process an HTML rule and send
the resulting HTML to a user for display by a browser. Known as stream processing.
this may involve the interpretation of JSP tags (or the older directives), which can
access the clipboard to obtain property values, or can insert other HTML rules, and
so on.
20
Optional. Leave blank in most situations. If you use the transid option
in a URL JSP tag, the system uses the frame name to verify the
transaction ID parameter pzTransactionID. If you enter a value for
HTMLFrame, use both the transid and the frame options in the URL JSP
tag. (As a best practice, use the name of the primary page as the frame
name.)
Technically, this frame name is only an assertion to the server engine as
to which HTML frame will receive the output, to enable a later redisplay if
required. The run-time destination frame is controlled through JavaScript
routines in the portal and may differ from this value.
When designing and implementing multiThread interactions for a
browser-based user session, it is a best practice to have each Thread that
uses the Show-HTML method send its HTML to a specific named HTML
frame on the browser window, to avoid confusion.
ReadOnly
Select this box to cause the system to present any HTML INPUT elements
on any form as display-only, so that the user receiving the HTML display
cannot enter or update data.
Clear this box to allow user input, the normal situation.
Results
The system uses rule resolution to access the HTML rule referenced in the first
parameter. It uses stream processing to evaluate and process all the JSP tags (or
directives) it contains. It sends the resulting processed HTML code using HTTP or
HTTPS protocol to the user who ran the activity.
The system stores the processed HTML as the value of the pxThread.pxHTMLStream
property on the Thread page.
Show-Page method:
Use the Show-Page method to send an XML representation of the step page to a
user's browser session, typically as an aid to debugging.
21
Parameters
This method uses no parameters.
Checking the method status
This method updates the pxMethodStatus property. See How to test method results
using a transition.
Restrictions
This method cannot be used in a step that involves iteration.
Show-Property method:
Use the Show-Property method to send the value of a single scalar property on the
clipboard page identified in the Step Page column to a user's browser session, as an
aid to debugging.
Parameters
This method has one required parameter.
Parameter
Property
Description
Enter an expression, such as a property name or reference to a Single
Value property; the property must not be a Java Object.
Results
The system sends the value of the expression or property to the user's browser.
Checking the method status
This method updates the pxMethodStatus property. See How to test method results
using a transition.
Notes
The Show-Page, Show-Stream, Show-Property and Show-HTML methods each send
an HTTP message corresponding to an entire document to the user's browser. They
can't be used in combination to assemble a document. Use Show-Property only for
debugging.
RDB-Save method:
Use this method to save the contents of a clipboard page into a row of a relational
database. The system saves the properties on the specified step page to the
specified table in the database.
This method operates in conjunction with a Connect SQL rule that contains SQL
statements such as INSERT, UPDATE, and CREATE statements on the Save tab.
22
On the Save tab of the Connect SQL rule, use the special data syntax described in
Connect SQL rules Data mapping.
Use Connect SQL rules and the RDB-Save method only with an external
database. Do not use Connect SQL rules or RDB methods to update the PegaRULES
database. Because not all properties in the Process Commander databases are
distinct database columns, use the Obj-Open and Obj-Save methods, not the RDBmethods, with the PegaRULES database to prevent loss of data.
Parameters
This method has four parameters. Three required parameters together identify a
Connect SQL rule. The final parameter controls a processing option.
Parameter Description
ClassName
Enter the class of the step page. The system uses this as the Applies To
key part of a Rule-Connect-SQL rule.
Identify the exact class of the rule. The system does not use class
inheritance to find the Rule-Connect-SQL instance.
RequestType Enter the third key part Request Type of the Connect SQL rule
containing the save operation.
Access
Enter the second key part Package Name of the Connect SQL rule
(by convention MSSQL, Oracle, DB2, UDB, or Sybase, but not restricted
to these values).
23
RDB-Open method:
Use this method to retrieve a single row (record) of data from an external relational
database and add the retrieved data into a specified clipboard page as property
names and values.
Use this method in conjunction with a Connect SQL rule that contains SQL SELECT or
EXECUTE statements in the Open tab. Define the SQL statements so that the
database returns exactly one row. (To search the external database with criteria that
may sometimes find no rows, or find more than one row, use the RDB-Browse
method, not the RDB-Open method.)
On the Open tab of the Connect SQL rule, use the special data syntax described in
Connect SQL rules Data mapping.
Except in rare cases, identify in the Step Page field the name of the page to be
created by this method. If the Step Page field of the step is blank, this method
clears the primary page of the current activity and may change its class.
Typically, this is not desirable.
Use Connect SQL rules and the RDB-Open method only with an external
database. Do not use Connect SQL rules or RDB methods to updated the
PegaRULES database(s). Because not all properties in the Process Commander
databases are distinct database columns, use the Obj-Open and Obj-Save methods,
not the RDB- methods, with the PegaRULES database to prevent loss of data.
Parameters
This method has four parameters. Three required parameters together identify a
Connect SQL rule. The final parameter controls a processing option.
Parameter
OpenClass
Description
Enter the Applies To key part of the Connect SQL rule that defines the
open SQL. This must match the class of the step page.
Identify the exact class of the rule. The system does not use class
inheritance to find the Rule-Connect-SQL rule instance.
RequestType
Enter the third key part Request Type of the Connect SQL rule
containing the open operation.
Access
Enter the second key part Package Name of the Connect SQL rule
(by convention MSSQL, Oracle, DB2, UDB, or Sybase, but you are not
restricted to these values).
24
CLASS instructions within the SQL statement. If the SQL statement contains
more than one CLASS directive, the most specific concrete class is used.
If the step page exists, the system changes the class of the step page to the class
determined by the above algorithm. If the step page does not exist, the system
creates a new page with a that class.
If the external database request returns no rows, or more than one row, the step
page is not updated and the method returns a fail status.
When the RunInParallel box is selected, the SQL operation occurs in a new requestor
session. This temporary requestor has the same access group and clipboard as the
original. At most 10 such child requestor sessions can be active at once.
Each RDB-Open, RDB-Save, and RDB-Delete method involves an SQL database
commit operation. You cannot implement SQL transaction commit operations
spanning two or more Connect SQL rules.
Debugging SQL and SQL performance
You can use the DB Trace feature of the Performance tool to view in depth
Log-Message method:
25
Use the Log-Message method to append a message to the Pega log when the step is
reached. Depending on method parameters and the current logging level, a line is
added to the Pega log on the current node.
Additions to the Pega log consume system resources. Select the LoggingLevel
parameter carefully. For best performance, remove or convert to comments the
steps containing this method when they are no longer needed.
Parameters
The Log-Message method accepts four parameters:
Parameter
Message
Description
Enter the text of the message between double quotes, or an
expression that results in a text value. For example:
"Test45: Work item "+.pyID+" status= "+ .pyStatusWork
The predefined Java variable myStepPage identifies the step page
of the method. For example, to include the entire contents of the
step page in the log as an XML document, set the Message
parameter to:
"The step page:" + @getStepPageHandle(tools) +
"contains the following properties:\n +
@getXMLOfPage(myStepPage)
LoggingLevel
26
Results
If the LoggingLevel parameter is set to InfoForced, a message is added to the Pega
log on the current node.
If the LoggingLevel parameter is set to Debug, Info, Warn, or Error, results of this
method depend on a comparison of the LoggingLevel parameter with the
prlogging.xml setting on the current node for the Rule-Obj-Activity class. If the value
of the parameter is equal to or greater than the severity value of the setting, the
message is added to the log and other processing occurs as described above. You
can temporarily override the setting in the prlogging.xml file using the Set Logging
Level tool. Severity levels range from DEBUG (lowest level, most messages) to INFO,
WARN, ERROR, and FATAL (highest level, fewest messages).
If requested, a Java stack trace is also added to the Pega log. If requested, a Tracer
event is generated. These events appear in Tracer output if the Log-Message
checkbox is selected on the Tracer Options form.
When debugging is complete, you can delete the steps that use this method or
change them to comment steps. This is needed for steps where LoggingLevel is set
to InfoForced. For others, if the prlogging.xml setting for the Rule-Obj-Activity class is
higher than the LoggingLevel parameter, executing this method does not update the
Pega log and does not affect performance.
Apply-Parse-XML method:
Use this method in activities to parse an XML document contained in the value of a
property and add them to the step page. This method locates and executes a Parse
XML rule (Rule-Parse-XML rule type) and parses the XML document text into values
for multiple other properties.
Parameters
The system uses the class of the step page as the Applies To key part of the desired
Parse XML rule. (It determines this class from the Pages & Classes information on
the Activity form.)
27
Description
Enter a value that is the second key part of a Parse XML rule.
Optional. Enter a value that is the third key part of a Parse XML rule.
Results
The system determines the class of the page identified in the Step Page column
using the Pages & Classes information for the activity rule (If the Step Page field is
blank, it uses the class that is the Applies To key part of the activity, the class of the
primary page). The system assembles the key of a Parse XML rule from that class,
the NameSpace parameter, and the ElementName parameter.
Finally, it executes the Parse XML rule in the current context. This parses the input
XML document (the value of the property referenced in the SourceProperty
parameter) into other property values and adds these to the step page.
Connect-File method:
Use the Connect-File method to invoke a Connect File rule (Rule-File-Connect rule
type). The rule can create, add contents to, or close an output file.
Parameters
This method has three parameters:
Parameter
Description
ConnectorNa Enter the Connector Name (second key part) of a Connect File rule, an
me
instance of the Rule-Connect-File rule type. The system uses the class
of the step page as the first key part of the rule.
Operation
28
Parameter
For HTML Stream rules, XML Stream rules, or Write from Map
Structured rule, enter the second key part of the rule. The
system uses the class of the step page (or the class of the
activity) with rule resolution to find the rule. (For XML Stream
rules, the third key part must be MapFrom.)
Results
The Connect-File method works as follows:
1. Using rule resolution, locates the Connect File rule.
2. Uses information in the Service tab of the rule to identify the path and file
name of the output file, and processing instructions
3. Locates the rule or other object identified by the Operation and Parameter.
4. Opens the file if not already open, and appends the output.
5. Generates the output using stream processing, map eform processing or map
structured processing, if specified. If the map structured rule specifies a
character encoding other than Default, output characters are converted to the
specified character set using normal Java methods.
29
6. Closes the file, unless the Keep File open option on the Connect File rule is
selected.
7. Updates the value on the clipboard of the status and status message
properties identified in the rule.
If the Operation is Close File, steps 5 and 6 do not occur and the output file is closed.
Operation of this method is synchronous. Further processing in the activity does not
resume until the file processing completes.
Property-Set-Corr method:
Use this method to save the contents of a correspondence stream (generally HTML text) as
the value of a Single Value property. The property value can then be mapped as output for
transmission to an external system.
The target property value is the contents of a correspondence rule (Rule-Obj-Corr rule type),
after stream processing. Stream processing evaluates directives and clipboard references.
Don't attempt to set the value of a property that has a name starting with pz; these
properties are reserved. Don't use this method for a property that is the target property of a
Declare Expression rule.
Parameters
This method has three parameters:
Parameter
Description
PropertyName
Enter a Single Value target property reference. Identify the property that
receives its value from stream processing. Typically, choose a property that has
a Text type.
Enter the second key part the Correspondence Name of a correspondence
rule.
Enter a correspondence type that is the final key part of a correspondence rule.
corr stream
CorrType
Results
This method forms a key to a correspondence rule from the value you supply for the second
and third parameters and the class of the step page or of the activity. It uses rule resolution to
find the correspondence rule.
If the step page does not exist, a new page is created, of the class identified in the Pages &
Classes tab.
It then applies stream processing to interpret and evaluate the JSP tags or directives
(including property references) in this rule. It stores the resulting text as the value of the
property referenced in the PropertyName parameter.
If the Type of the expression doesn't match the Type of the destination, the value is converted
following the same scheme as within expressions. See Data type conversions (casting) in
expressions and property assignments.
30
Any property messages previously associated with the property are cleared. The property
value is validated against the property rule.
Cautions
You can't use this method for a property that is also the target property of a Declare
Expression rule. You can't save the Activity form if such a conflict is detected.
Don't attempt to set the value of a property that has a name starting with pz;
changes to such properties are reserved.
31