# PeopleCode Events and Firing Order Reference

> Source: https://netray.co/tools/peoplesoft-peoplecode-events-firing-order-reference
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

A searchable table of PeopleCode events in component processor order, showing where each event is defined, what it is for, whether Error and Warning are appropriate, and common mistakes.

## Category

oracle

## Erp

Oracle PeopleSoft

## Audience

- PeopleSoft developer
- PeopleSoft technical consultant

## Tool

**Kind:** worksheet

**Mode:** reference

**Columns:**

#### Order

**Key:** order

**Type:** number

#### Processing phase

**Key:** phase

**Type:** text

#### Event

**Key:** event

**Type:** text

#### Defined on

**Key:** defined

**Type:** text

#### When it fires

**Key:** fires

**Type:** text

#### Typical use

**Key:** use

**Type:** text

#### Error / Warning

**Key:** errors

**Type:** text

#### Common gotcha

**Key:** gotcha

**Type:** text

**Rows:**

#### Search processing

**Order:** 1

**Event:** SearchInit

**Defined:** Record field, component record (search record)

**Fires:** Before the search page is displayed

**Use:** Default search key values, hide or gray search fields, skip the search page with SetSearchDialogBehavior

**Errors:** Avoid

**Gotcha:** Only fires for fields on the component search record

#### Search processing

**Order:** 2

**Event:** SearchSave

**Defined:** Record field, component record (search record)

**Fires:** When the user clicks Search, before rows are fetched

**Use:** Require at least one search criterion, validate search values

**Errors:** Yes: Error keeps the user on the search page, Warning lets them continue

**Gotcha:** Does not fire when the search page is bypassed

#### Component build

**Order:** 3

**Event:** PreBuild

**Defined:** Component

**Fires:** Before the rest of the component build events

**Use:** Set component-scoped variables, hide pages, set up data that build events depend on

**Errors:** Avoid

**Gotcha:** Runs once per component build, not per row

#### Component build

**Order:** 4

**Event:** RowSelect

**Defined:** Record field, component record

**Fires:** As each row is read into the component buffer

**Use:** Filter rows from the buffer with DiscardRow or StopFetching

**Errors:** Use DiscardRow / StopFetching instead

**Gotcha:** Slow on large scrolls; filtering in SQL or the view is usually better. Think-time functions not allowed

#### Component build

**Order:** 5

**Event:** FieldDefault

**Defined:** Record field, component record field

**Fires:** During default processing when a field is blank

**Use:** Set a default value that cannot be set in the record field properties

**Errors:** Avoid (not for messages)

**Gotcha:** Only runs when the field has no value; for every-row logic use RowInit

#### Component build

**Order:** 6

**Event:** FieldFormula

**Defined:** Record field

**Fires:** During default processing, on many actions

**Use:** Legacy place for function libraries (FUNCLIB records)

**Errors:** Avoid

**Gotcha:** Delivered guidance is to keep only functions here; code here runs often and slows pages

#### Component build

**Order:** 7

**Event:** RowInit

**Defined:** Record field, component record

**Fires:** First time each row is loaded into the buffer, and for new rows

**Use:** Set display-only state, calculate derived fields, hide fields per row

**Errors:** No: Error or Warning here causes a runtime error

**Gotcha:** Fires per row and per record field, so heavy SQL here multiplies across rows

#### Component build

**Order:** 8

**Event:** PostBuild

**Defined:** Component

**Fires:** After all component build events

**Use:** Final setup once buffers are loaded, hide pages based on loaded data

**Errors:** Avoid

**Gotcha:** Good place for logic that needs the full buffer

#### Component build

**Order:** 9

**Event:** Activate

**Defined:** Page

**Fires:** Each time the page is displayed or the user tabs to it

**Use:** Page-level show or hide, page-specific initialisation

**Errors:** Avoid

**Gotcha:** Fires again on each page visit, so keep it light

#### Field action

**Order:** 10

**Event:** FieldEdit

**Defined:** Record field, component record field

**Fires:** When the user changes a field value and leaves the field

**Use:** Validate the new value

**Errors:** Yes: Error rejects the value and highlights the field, Warning lets the user accept

**Gotcha:** Validates only the changed field; cross-field rules belong in SaveEdit

#### Field action

**Order:** 11

**Event:** FieldChange

**Defined:** Record field, component record field

**Fires:** After FieldEdit succeeds, or when a push button is clicked

**Use:** Recalculate, populate other fields, button logic

**Errors:** Avoid (validate in FieldEdit)

**Gotcha:** Changing the same field here can trigger confusing loops

#### Row action

**Order:** 12

**Event:** RowInsert

**Defined:** Record field, component record

**Fires:** When the user inserts a row in a scroll or grid

**Use:** Default values on a new row

**Errors:** Avoid

**Gotcha:** RowInit also fires for the new row, so do not duplicate logic

#### Row action

**Order:** 13

**Event:** RowDelete

**Defined:** Record field, component record

**Fires:** When the user deletes a row

**Use:** Prevent deletion when dependent data exists, adjust totals

**Errors:** Yes: Error stops the delete, Warning asks to confirm

**Gotcha:** Child rows are deleted too, and RowDelete fires for them

#### Pop-up menu

**Order:** 14

**Event:** PrePopup

**Defined:** Record field, component record field

**Fires:** Before a pop-up menu is displayed

**Use:** Hide, gray or check pop-up menu items

**Errors:** Avoid

**Gotcha:** Only relevant where a pop-up menu is attached to the field

#### Pop-up menu

**Order:** 15

**Event:** ItemSelected

**Defined:** Menu item (pop-up menu)

**Fires:** When the user selects a pop-up menu item

**Use:** Run the action behind the menu item

**Errors:** Avoid

**Gotcha:** Code lives on the menu definition, not the record

#### Save processing

**Order:** 16

**Event:** SaveEdit

**Defined:** Record field, component record, component

**Fires:** When the user saves, for each row in the buffer

**Use:** Cross-field and cross-row validation before data is written

**Errors:** Yes: Error stops the save, Warning lets the user cancel or continue

**Gotcha:** The right place for validation; pair errors with SetCursorPos or field highlighting so users find the problem

#### Save processing

**Order:** 17

**Event:** SavePreChange

**Defined:** Record field, component record, component

**Fires:** After SaveEdit, before the database is updated

**Use:** Final field changes before write, assign keys or sequence numbers

**Errors:** Error rolls back the save; validate in SaveEdit instead

**Gotcha:** Think-time functions not allowed

#### Save processing

**Order:** 18

**Event:** Workflow

**Defined:** Record field, component record, component

**Fires:** After SavePreChange, before the database update

**Use:** Workflow routing and triggering business events

**Errors:** Avoid

**Gotcha:** Think-time functions not allowed

#### Save processing

**Order:** 19

**Event:** SavePostChange

**Defined:** Record field, component record, component

**Fires:** After the database is updated, before commit

**Use:** Update other tables, publish Integration Broker messages, call component interfaces

**Errors:** Avoid: data is already written

**Gotcha:** Think-time functions not allowed; failures here leave users confused because the main data saved

**Notes:** 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'.

## Content

**Intro:** 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.

**Sections:**

#### How to use it

**Body:** 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.

**Bullets:**

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

#### Where events are defined

**Body:** 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

**Body:** 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

**Body:** 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.

**Bullets:**

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

**Cta:** 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.

**Faq:**

#### What is the order of PeopleCode events?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

peoplecode events, peoplecode saveedit, peoplecode events order, set component changed peoplecode example, what is peoplecode, peoplecode highlight error field, peoplecode rowinit vs fielddefault, saveprechange vs savepostchange

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
