Understanding Execution Order of Events and PeopleCode*
In PeopleSoft, the component is the representation of a transaction.
Therefore, any PeopleCode that is associated with a transaction should be in
events associated with some level of the component. Code that should be
executed every time a field is edited should be at the record field level.
If you associate code with the correct transaction, you do not have to check
for the component that is issuing it (such as surrounding your code with
dozens of If %Component = statements). Records are more reusable, and code
is more maintainable.
For example, if you have start and end dates for a course, you would always
want to make sure that the end date was after the start date. Your program
to check the dates would go on the SaveEdit at the record field level. All
similarly named component events are initiated after the like-named record
event. The PeopleCode program associated with the record field event is
initiated first, and then the PeopleCode program associated with the
like-named component event is initiated. If you set the value of a field
with the record field PeopleCode, and then reset the field with like-named
componentPeopleCode, the second value is displayed to the user.
*Events After Field ChangesThe following events occur after a user changes a
field:*
Record.recordA.fielda.FieldEdit ->Component.recordA.fielda.FieldEdit ->
Record.recordB.fieldb.FieldEdit ->Component.recordB.fieldb.FieldEdit ->
Record.recordA.fielda.FieldChange ->Component.recordA.fielda.FieldChange ->
Record.recordB.fieldb.FieldChange ->Component.recordB.fieldb.FieldChange ->
The following diagram shows the event flow:
[image: Your browser may not support display of this image.]
*Events After User Saves*
The following events occur after a user saves:Record.recordA.fielda.SaveEdit->
Record.recordA.fieldb.SaveEdit ->
Record.recordA.fieldc.SaveEdit ->
Component.recordA.SaveEdit
Record.recordB.fielda.SaveEdit ->
Record.recordB.fieldb.SaveEdit ->
Record.recordB.fieldc.SaveEdit ->
Component.recordB.SaveEdit
Record.recordA.fielda.SavePreChange ->
Record.recordA.fieldb.SavePreChange ->
Record.recordA.fieldc.SavePreChange ->
Component.recordA.SavePreChange
Record.recordB.fielda.SavePreChange ->
Record.recordB.fieldb.SavePreChange ->
Record.recordB.fieldc.SavePreChange ->
Component.recordB.SavePreChange
Record.recordA.fieldA.WorkFlow ->
Record.recordB.fieldB.WorkFlow ->
Record.reocrdC.fieldC.WorkFlow
Component.Workflow
Record.recordA.fielda.SavePostChange ->
Record.recordA.fieldb.SavePostChange ->
Record.recordA.fieldc.SavePostChange ->
Component.recordA.SavePostChange
Record.recordB.fielda.SavePostChange ->
Component.recordB.SavePostChange
Component.SavePostChange
The following diagram shows the event flow:[image: Your browser may not
support display of this image.]
*PeopleCode Program Triggers*
PeopleCode can be associated with a PeopleCode record field, a component
record, and many other items. PeopleCode events are initiated at particular
times, in particular sequences, during the course of the Component
Processor's flow of execution. When an event is initiated, it triggers
PeopleCode programs on specific objects.
The following items have events that are part of the Component Processor
flow:
*Items* *Event Triggers* Menu items Programs associated with the menu
item Component record fields Programs on specific rows of data Component
records Programs on specific rows of data Components Programs associated
with the component Pages Programs associated with the page Record
fields Programs
on specific rows of data
Suppose a user changes the data in a page field, then presses Tab to move
out of the field. This user action initiates the FieldEditPeopleCode event.
The FieldEdit event affects only the field and row where the change took
place. If a FieldEditPeopleCode program is associated with that record
field, the program is executed once.
If you have two FieldEditPeopleCode programs, one associated with the
record field and a second associated with the component record field, both
programs execute, but only on the specific field and row of data. The
FieldEditPeopleCode program associated with the first record field is
initiated first, and then the FieldEditPeopleCode program associated with
the first component record field is initiated.
By contrast, suppose a user has opened a component for updating. As part of
building the component, the Component Processor initiates the RowInit event.
This event triggers RowInitPeopleCode programs on every record field on
every row of data in the component. In a scroll area with multiple rows of
data, every RowInitPeopleCode program is executed once for each row.
In addition, if you have RowInitPeopleCode associated with both the record
field and the component record, both programs are executed against every
record field on every row of data in the component. The RowInitPeopleCode
program associated with the first record field is initiated first, and then
theRowInitPeopleCode program associated with the first component record is
initiated. If you set the value of a field with the record field RowInit
PeopleCode, and then reset the field with the component record RowInit
PeopleCode, the second value appears to the user.
When you develop with PeopleCode, you must consider when and where your
programs are triggered during the Component Processor's flow of execution.
This section discusses how to:
- Access PeopleCode programs.
- Understand the execution order of events and PeopleCode.
*See Also *
*Understanding Execution Order of Events and
PeopleCode*
*Accessing PeopleCode Programs*
Every PeopleCode program is associated with a PeopleCode event, and is often
referred to by that name, such as RowInitPeopleCode or FieldChange
PeopleCode. These programs are accessible from, and associated with,
different items. The following table lists items and associated events.
*Note. *The SearchInit and SearchSave events (in the Component Record column
of the table) are available only for the search record associated with a
component.
*Record Field Events* *Component Record Field Events* *Component
Record Events* *Component Events* *Page Events* *Menu Events*
- FieldChange
- FieldDefault
- FieldEdit
- FieldFormula
- PrePopup
- RowDelete
- RowInit
- RowInsert
- RowSelect
- SaveEdit
- SavePostChg
- SavePreChg
- SearchInit
- SearchSave
- Workflow
- FieldChange
- FieldDefault
- FieldEdit
- PrePopup
- RowDelete
- RowInit
- RowInsert
- RowSelect
- SaveEdit
- SavePostChg
- SavePreChg
- SearchInit
- SearchSave
- PostBuild
- PreBuild
- SavePostChg
- SavePreChg
- Workflow
Activate ItemSelected
The following table lists types of PeopleCode programs and where to access
them in PeopleSoft Application Designer.
*PeopleCode Programs* *Location in PeopleSoft Application Designer* Record
field Record definitions and page definitions Component record field,
component record, and component Component definitions Menu item Menu
definitions Page field Page definitions
0 comments:
Post a Comment
Phaniraavi@gmail.com