Peoplecode Events
Peoplecode Events
Peoplecode Events
Events
People Code Events Introduction
Business logic is coded into PeopleSoft applications by means of
People Code events
The Activate event is fired every time the page is activated. This means when the page is first
brought up by the end-user, or if a end-user tabs between different pages in a component.
Every page has its own Activate event.
The main purpose of the Activate event is to segregate the PeopleCode that is related to a
specific page from the rest of your application's PeopleCode. PeopleCode related to page display
or page processing, such as enabling a field or hiding a scroll, is best put in this event. Also, you
can use this event for security validation: if an user doesn't have clearance to view a page in a
component, you would put the code for hiding it in this event.
Note. The Activate event isn't associated with a specific row and record at the point of
execution. This means you can't use functions such as GetRecord, GetRow, and so on, that
rely on context, without specifying more context.
• This event is only valid for pages that are defined as Standard or Secondary. This event is not
supported for subpages.
Record Level Events
FieldChange Event
FieldChange PeopleCode is used to recalculate page field values, change the appearance of page
controls, or perform other processing that results from a field change other than data validation.
• Do not use Error or Warning statements in FieldChange PeopleCode: these statements cause a
runtime error that forces the end-user to cancel the page without saving changes.
• FieldChange PeopleCode can be associated with record fields and component record fields.
FieldDefault Event
The FieldDefault PeopleCode event allows you to programmatically set fields to default values
when they are initially displayed.
You must attach FieldDefault PeopleCode to the specific field that is being defaulted.
FieldDefault PeopleCode can be associated with record fields and component record fields.
Note. An Error or Warning issued from FieldDefault PeopleCode will cause a runtime error and force
cancellation of the component
FieldDefault PeopleCode can be associated with record fields and component record fields.
FieldEdit Event
FieldEdit PeopleCode is used to validate the contents of a field, supplementing the standard system
edits. If the data does not pass the validation, the PeopleCode program should display a message
using the Error statement, which redisplays the page, showing an error message and turning the field
red.
• The FieldEdit event fires on the specific field and row that just changed.
• FieldEdit PeopleCode can be associated with record fields and component record fields.
FieldFormula Event
FieldFormula PeopleCode fires in many different contexts and triggers PeopleCode on every field on
every row in the component buffer, it can seriously degrade the performance of your application. In
recent PeopleSoft applications, the RowInit and FieldChange events are used rather than
FieldFormula.
FieldFormula Event
FieldFormula PeopleCode fires in many different contexts and triggers PeopleCode on every field
on every row in the component buffer, it can seriously degrade the performance of your application.
In recent PeopleSoft applications, the RowInit and FieldChange events are used rather than
FieldFormula.
!FieldFormula
Do not use Field Formula isPeople
PeopleCode Code in your
only associated withcomponents.
record fields.Use it only to store external PeopleCode
functions in FUNLIB_ record definitions .
PrePopup Event
The PrePopup event fires just before the display of a pop-up
menuuse.PrePopup PeopleCode to control the appearance of
the Pop-up menu.
RowDelete Event
The RowDelete event fires whenever a end-user attempts to
delete a row of data from a page scroll. You can use RowDelete
PeopleCode to prevent the deletion of a row (using an Error or
Warning statement) or to perform any other processing
contingent on row deletion.
RowInit Event
The RowDelete event fires whenever a end-user attempts to
delete a row of data from a page scroll. You can use RowDelete
PeopleCode.
to prevent the deletion of a row (using an Error or
Warning statement) or to perform any other processing
contingent on row deletion.
• The RowDelete event triggers PeopleCode on any field on the
row of data that is being flagged as deleted.
RowInsert Event
When the end-user adds a row of data, the Component Processor generates a RowInsert event. You should
use RowInsert PeopleCode for processing specific to the insertion of new rows. Do not put PeopleCode in
RowInsert that already exists in RowInit, because a RowInit event always fires after the RowInsert event,
which will cause your code to be run twice.
•The RowInsert triggers PeopleCode on any field on the inserted row of data.
Do not use a Warning or Error in RowInsert: this will cause a runtime error and force cancellation of the
component
•You can prevent the end-user from inserting rows into a scroll area by checking the No Row Insert box in the
scroll bar's Page Field Properties; however, you can't prevent row insertion conditionally .
RowInsert PeopleCode can be associated with record fields and component records
.
RowSelect Event
The RowSelect event fires at the beginning of the Component Build process in any of the Update action modes
(Update, Update/Display All, Correction). RowSelect PeopleCode is used to filter out rows of data as they are
being read into the component buffer. This event also occurs after a ScrollSelect or related function is executed
Note. In RowSelect PeopleCode, you can only refer to record fields on the record that is currently being
processed.
Note. This event, and all it's associated PeopleCode, will not fire if run from a Component Interface.
•RowSelect PeopleCode can be associated with record fields and component records.
SaveEdit Event
The SaveEdit event fires whenever the end-user attempts to save the component. You can use
SaveEdit PeopleCode to validate the consistency of data in component fields. Whenever a
validation involves more than one component field, you should use SaveEdit PeopleCode. If a
validation involves only one page field, you should use FieldEdit PeopleCode.
•SaveEdit is not field-specific: it triggers associated PeopleCode on every row of data in the
component buffers, except rows flagged as deleted
•SaveEdit PeopleCode can be associated with record fields and components
SavePostChange Event
After the Component Processor updates the database, it fires the SavePostChange event. You
can use SavePostChange PeopleCode to update tables not in your component using the
SQLExec built-in function.
An Error or Warning in SavePostChange PeopleCode will cause a runtime error, forcing the end-
user to cancel the component without saving changes. Avoid Errors and Warnings in the this
event
Caution! Never issue a SQL Commit or a Rollback manually from within a SQLExec function. Let
the Component Processor issue these SQL commands.
•SavePostChange PeopleCode can be associated with record fields, components and component
records
SavePreChange Event
The SavePreChange event fires after SaveEdit completes without errors. SavePreChange
PeopleCode gives you one last chance to manipulate data before the system updates the
database; for instance, you could use SavePreChange PeopleCode to set sequential high-level
keys. If SavePreChange runs successfully, a WorkFlow event is generated, then the Component
Processor issues appropriate INSERT, UPDATE, and/or DELETE SQL commands.
•SavePreChange PeopleCode is not field-specific: it triggers PeopleCode on all fields and on all
rows of data in the component buffer.
•SavePreChange PeopleCode can be associated with record fields, components and component
records.
SearchInit Event
The SearchInit event is generated just before a search dialog, add dialog, or data entry dialog is
displayed. SearchInit triggers associated PeopleCode in the search key fields of the search
record. This allows you to control processing before the end-user enters values for search keys
in the dialog. In some cases you wish to set the value of the search dialog fields
programmatically.
EMPLID = %EmployeeId;
Gray (EMPLID);
AllowEmplIdChg(true);
Note. This event, and all it's associated PeopleCode, will not fire if run from a Component Interface.
SearchInit PeopleCode can be associated with record fields and component search records.
SearchSave Event
SearchSave PeopleCode is executed for all search key fields on a search dialog, add dialog, or
data entry dialog after the end-user clicks Search. This allows you to control processing after
search key values are entered, but before the search based on these keys is executed. A typical
use of this feature is to provide cross-field edits for selecting a minimum set of key information. It
is also used to force the user to enter a value in at least one field, even if it's a partial value to
help narrow a search for tables with many rows.
Note. SearchSave does not fire when values are selected from the search list. If you need to validate data
entered in the search dialog, use the Component PreBuild event to do so.
Note. This event, and all it's associated PeopleCode, will not fire if run from a Component Interface
SearchSave PeopleCode can be associated with record fields and component search records.
Workflow Event
Workflow PeopleCode executes immediately after SavePreChange and before the database
update that precedes SavePostChange. The main purpose of the Workflow event is to segregate
PeopleCode related to Workflow from the rest of your application's PeopleCode. Only PeopleCode
related to Workflow (such as TriggerBusinessEvent) should be in Workflow programs. Your
program should deal with Workflow only after any SavePreChange processing is complete.
•Workflow PeopleCode is not field-specific: it triggers PeopleCode on all fields and on all rows of
data in the component buffer.
•WorkFlow PeopleCode can be associated with record fields and components.
PostBuild Event
The PostBuild event fires after all the other component build events have fired. This event is often used to
hide or unhide pages. It's also used to set component variables.
PostBuild PeopleCode is only associated with components.
PreBuild Event