OracleFree referencePDF, Excel, Word exportOracle PeopleSoftAll Oracle PeopleSoft tools

PeopleCode Events and Firing Order Reference

This table lists PeopleCode events in the order the component processor fires them, with where each is defined, typical use and whether Error and Warning belong there. It applies to PeopleTools 8.5x and 8.6x classic and Fluid components.

Download:
OrderProcessing phaseEventDefined onWhen it firesTypical useError / WarningCommon gotcha
1
Search processing
SearchInit
Record field, component record (search record)
Before the search page is displayed
Default search key values, hide or gray search fields, skip the search page with SetSearchDialogBehavior
Avoid
Only fires for fields on the component search record
2
Search processing
SearchSave
Record field, component record (search record)
When the user clicks Search, before rows are fetched
Require at least one search criterion, validate search values
Yes: Error keeps the user on the search page, Warning lets them continue
Does not fire when the search page is bypassed
3
Component build
PreBuild
Component
Before the rest of the component build events
Set component-scoped variables, hide pages, set up data that build events depend on
Avoid
Runs once per component build, not per row
4
Component build
RowSelect
Record field, component record
As each row is read into the component buffer
Filter rows from the buffer with DiscardRow or StopFetching
Use DiscardRow / StopFetching instead
Slow on large scrolls; filtering in SQL or the view is usually better. Think-time functions not allowed
5
Component build
FieldDefault
Record field, component record field
During default processing when a field is blank
Set a default value that cannot be set in the record field properties
Avoid (not for messages)
Only runs when the field has no value; for every-row logic use RowInit
6
Component build
FieldFormula
Record field
During default processing, on many actions
Legacy place for function libraries (FUNCLIB records)
Avoid
Delivered guidance is to keep only functions here; code here runs often and slows pages
7
Component build
RowInit
Record field, component record
First time each row is loaded into the buffer, and for new rows
Set display-only state, calculate derived fields, hide fields per row
No: Error or Warning here causes a runtime error
Fires per row and per record field, so heavy SQL here multiplies across rows
8
Component build
PostBuild
Component
After all component build events
Final setup once buffers are loaded, hide pages based on loaded data
Avoid
Good place for logic that needs the full buffer
9
Component build
Activate
Page
Each time the page is displayed or the user tabs to it
Page-level show or hide, page-specific initialisation
Avoid
Fires again on each page visit, so keep it light
10
Field action
FieldEdit
Record field, component record field
When the user changes a field value and leaves the field
Validate the new value
Yes: Error rejects the value and highlights the field, Warning lets the user accept
Validates only the changed field; cross-field rules belong in SaveEdit
11
Field action
FieldChange
Record field, component record field
After FieldEdit succeeds, or when a push button is clicked
Recalculate, populate other fields, button logic
Avoid (validate in FieldEdit)
Changing the same field here can trigger confusing loops
12
Row action
RowInsert
Record field, component record
When the user inserts a row in a scroll or grid
Default values on a new row
Avoid
RowInit also fires for the new row, so do not duplicate logic
13
Row action
RowDelete
Record field, component record
When the user deletes a row
Prevent deletion when dependent data exists, adjust totals
Yes: Error stops the delete, Warning asks to confirm
Child rows are deleted too, and RowDelete fires for them
14
Pop-up menu
PrePopup
Record field, component record field
Before a pop-up menu is displayed
Hide, gray or check pop-up menu items
Avoid
Only relevant where a pop-up menu is attached to the field
15
Pop-up menu
ItemSelected
Menu item (pop-up menu)
When the user selects a pop-up menu item
Run the action behind the menu item
Avoid
Code lives on the menu definition, not the record
16
Save processing
SaveEdit
Record field, component record, component
When the user saves, for each row in the buffer
Cross-field and cross-row validation before data is written
Yes: Error stops the save, Warning lets the user cancel or continue
The right place for validation; pair errors with SetCursorPos or field highlighting so users find the problem
17
Save processing
SavePreChange
Record field, component record, component
After SaveEdit, before the database is updated
Final field changes before write, assign keys or sequence numbers
Error rolls back the save; validate in SaveEdit instead
Think-time functions not allowed
18
Save processing
Workflow
Record field, component record, component
After SavePreChange, before the database update
Workflow routing and triggering business events
Avoid
Think-time functions not allowed
19
Save processing
SavePostChange
Record field, component record, component
After the database is updated, before commit
Update other tables, publish Integration Broker messages, call component interfaces
Avoid: data is already written
Think-time functions not allowed; failures here leave users confused because the main data saved

Order shows the default flow of the component processor: search, build, field and row actions as the user works, then save. Within one event, PeopleCode runs on record field level before component record field and component record level, in buffer order. Confirm details for your release in PeopleBooks, 'PeopleCode and the Component Processor'.

Get a PeopleCode review of one component

Send us the component name and your tools release and we will review event placement and performance of its custom PeopleCode.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

How to use it

Search for an event name or a task such as default, validate or hide. Read across: the defined-on column tells you where to place the code in Application Designer (record field, component record field, component record, component, page or menu), and the gotcha column covers the mistakes reviewers flag. Use the order column when debugging: if a value is wrong at save, work back through the events that ran before. Export to Excel for a team coding standard.

  • Validation of a single field: FieldEdit
  • Validation across fields or rows: SaveEdit
  • Updates to other tables after save: SavePostChange

Where events are defined

Record field PeopleCode sits on the record and runs in every component that uses the record, so it suits rules that are always true. Component record field and component record PeopleCode sit on the component and run only there, which is safer for component-specific logic. Component events (PreBuild, PostBuild, SaveEdit, SavePreChange, SavePostChange, Workflow) run once at component level. Page Activate runs when the page shows. ItemSelected lives on pop-up menu items. In PSPCMPROG, OBJECTVALUE columns hold the record, field and event names, which is how you find code by event.

Worked example: validate a date range and highlight the field

A custom page has BEGIN_DT and END_DT. Placing the check in END_DT FieldEdit catches a bad end date as soon as the user leaves the field: Error stops the value and highlights END_DT. But if the user changes BEGIN_DT afterwards, FieldEdit on END_DT does not fire again, so put the cross-field check in SaveEdit too. When code updates buffer fields outside normal user input and the component should treat the data as changed, SetComponentChanged() marks the component changed so the save prompt and save processing run.

Gotchas

Think-time functions, those that wait for the user such as DoModal, a message box needing a reply, or Prompt, are not allowed in SavePreChange, SavePostChange, Workflow and RowSelect. Error and Warning in RowInit cause a runtime error. Heavy SQL in RowInit or FieldFormula runs once per row and per page visit, which is the most common cause of slow pages. Component interfaces run the same component PeopleCode without the user interface, so code assuming a user can respond to a prompt breaks in integrations and Application Engine calls.

  • Keep FieldFormula for function libraries only
  • Test logic through component interfaces as well as online
  • Use SetComponentChanged only when buffer changes need saving

Frequently Asked Questions

What is the order of PeopleCode events?

Search processing runs SearchInit then SearchSave. Component build runs PreBuild, RowSelect, FieldDefault, FieldFormula, RowInit, PostBuild and page Activate. While the user works, FieldEdit and FieldChange fire on field changes and RowInsert or RowDelete on rows. Save runs SaveEdit, SavePreChange, Workflow and SavePostChange.

When should I use SaveEdit in PeopleCode?

Use SaveEdit for validations that depend on more than one field or row, or that must be checked every time before data is written. An Error in SaveEdit stops the save and returns the user to the page, and a Warning lets them choose to continue. It runs before SavePreChange and before any database update.

How do I highlight a field with an error in PeopleCode?

An Error statement in FieldEdit rejects the value and highlights the field that triggered it. In SaveEdit, Error placed in record field PeopleCode is associated with that field and row. For component-level save errors, use SetCursorPos to move the user to the field that needs correcting.

What does SetComponentChanged do?

SetComponentChanged() marks the current component as changed, so the save warning appears if the user leaves and save processing runs when they save. It is used when PeopleCode changes data in a way the component processor would not detect as a user change, for example values set in derived records or work fields.

If you want an assistant that explains your custom PeopleCode and where each event fires, running privately on your own PeopleSoft servers, we can build that with you.