Professional Documents
Culture Documents
Application Services
PeopleCode Events
1
PeopleTools
PeopleSoft applications are designed using the
powerful tools provided by PeopleSoft:
Application Designer
PeopleCode
Application Engine
PeopleCode is a 4GL and has a rich syntax and
structure to develop & incorporate complex
application logic
2
PeopleCode
PeopleCode is simple but yet high-powered language to
satisfy complex business requirements within PeopleSoft.
3
PeopleCode Events
PeopleSoft uses “Events” to control the flow and
functionality of the application
PeopleCode Programs are attached to the events supported
by PeopleSoft
4
PeopleCode Events – High Level Flow
MENU Activate
RowSelect SaveEdit
FieldChange
PreBuild SavePrechange
YES
Popup Menu
FieldDefault WorkFlow
NO
PrePopup
FieldFormula Other Actions
SavePostChange
ItemSelected
RowInit
Row Actions?
Insert Delete
PostBuild
RowInsert RowDelete
5
PeopleCode Event - SearchInit Event
MENU Activate
RowSelect SaveEdit
FieldChange
PreBuild SavePrechange
YES
Popup Menu
FieldDefault WorkFlow
NO
PrePopup
FieldFormula Other Actions
SavePostChange
ItemSelected
RowInit
Row Actions?
Insert Delete
PostBuild
RowInsert RowDelete
6
PeopleCode Events
SearchInit
When is it fired?
7
PeopleCode Events
SearchInit
Where is it used?
SearchInit can be associated with record fields and
component search records.
8
PeopleCode Events
SearchInit
9
PeopleCode Events
SearchInit
Restrictions
SearchInit will not trigger if run from a component interface
Can’t use functions like DoModal,
DoModalComponent,Transfer,TransferPage in
SearchInit event.
10
PeopleCode Events
SearchInit event
Example
11
SearchInit Event
12
SearchInit Event
13
SearchInit Event
14
SearchInit Event
15
PeopleCode Event - SearchSave Event
MENU Activate
RowSelect SaveEdit
FieldChange
PreBuild SavePrechange
YES
Popup Menu
FieldDefault WorkFlow
NO
PrePopup
FieldFormula Other Actions
SavePostChange
ItemSelected
RowInit
Row Actions?
Insert Delete
PostBuild
RowInsert RowDelete
16
PeopleCode Events
SearchSave
When is it fired?
To control processing after search key values are
entered, but before the search based on these keys is
executed.
17
PeopleCode Events
SearchSave
Where is it used?
SearchSave PeopleCode can be associated with record
fields and component search records.
18
PeopleCode Events
SearchSave
What is it used for?
The typical use of this feature is to provide cross-field edits for
selecting a minimum set of key information.
19
PeopleCode Events
SearchSave
Restrictions
SearchSave does not fire when values are selected from
the search list.
This event, and all it’s associated PeopleCode, will not fire
if run from a component interface.
20
SearchSave event
21
SearchSave event
22
PeopleCode Event - RowSelect Event
MENU Activate
RowInit
Row Actions?
23
PeopleCode Events
RowSelect Event
24
PeopleCode Events
RowSelect
When is it fired?
The RowSelect event fires at the beginning of the Component Build
process in any of the Update action modes (Update, Update/Display
All, Correction).
25
PeopleCode Events
RowSelect
Where is it used?
RowSelect PeopleCode is used to filter out rows of data
as they are being read into the component buffer.
26
PeopleCode Events
RowSelect
What is it used for?
A DiscardRow function in RowSelect PeopleCode causes the
Component Processor to skip the current row of data and continue
to process other rows.
A StopFetching statement causes the Component Processor to
accept the current row of data, then stop reading additional rows. If
both statements are executed, the program skips the current row of
data, then stops reading additional rows.
27
PeopleCode Events
RowSelect
Restrictions
In RowSelect PeopleCode, you can refer to record fields
only on the record that is currently being processed
This event, and all it’s associated PeopleCode, will not fire
if run from a Component Interface.
28
PeopleCode Events
RowSelect
Row Select Processing
Row Select processing enables PeopleCode to filter out rows of data
after they have been retrieved from the database server using a
SQL Select statement and before they are copied to the component
buffers.
29
RowSelect Event
30
RowSelect Event
31
RowSelect Event
32
RowSelect Event
33
RowSelect Event
34
RowSelect Event
35
PeopleCode Event - PreBuild Event
MENU Activate
RowInit
Row Actions?
36
PeopleCode Event
PreBuild Event
37
PeopleCode Event
PreBuild Event
When is it fired?
38
PeopleCode Event
PreBuild Event
Where is it used?
39
PeopleCode Event
PreBuild Event
40
PreBuild Event
41
PreBuild Event
42
PreBuild Event
43
PreBuild Event
44
PeopleCode Event - FieldDefault Event
MENU Activate
RowInit
Row Actions?
45
PeopleCode Events
FieldDefault Event
The FieldDefault PeopleCode event enables you to
programmatically set default values to the fields when
they are initially displayed.
46
PeopleCode Events
FieldDefault
When is it fired?
This event is fired on all page fields as part of many different
processes; however it triggers PeopleCode programs only when the
following conditions are all true:
47
PeopleCode Events
FieldDefault
Where is it used?
48
PeopleCode Events
FieldDefault
49
PeopleCode Events
50
PeopleCode Events
FieldDefault
Restrictions
51
FieldDefault Event
52
FieldDefault Event
53
PeopleCode Event - FieldFormula Event
MENU Activate
RowInit
Row Actions?
54
PeopleCode Events
FieldFormula Event
55
PeopleCode Events
FieldFormula
When is it fired?
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.
56
PeopleCode Events
FieldFormula
Where is it used?
57
PeopleCode Events
FieldFormula
58
PeopleCode Events
FieldFormula
Restrictions
Do not use FieldFormula PeopleCode in your
components.
59
FieldFormula Event
60
FieldFormula Event
61
FieldFormula Event
62
PeopleCode Event - RowInit Event
MENU Activate
RowInit
Row Actions?
63
PeopleCode Events
RowInit
When it is fired?
The RowInit event fires the first time the component
Processor encounters a row of data.
64
PeopleCode Events
RowInit
Where is it used?
It is used for setting the initial state of Component Controls.
65
PeopleCode Events
RowInit
66
PeopleCode Events
RowInit
Restrictions
Do not use “ERROR” or “WARNING” statement in RowInit
PeopleCode, this causes a runtime error and forces the end-user
to cancel the component.
Code in FieldChange event would not be executed if
The Record is at level 0.
Every record field that is present in the data buffer is also
present in the keys for the component.
Every record field that is present in the data buffers is
display only.
RowInit is often paired with FieldChange PeopleCode .
The component processor runs RowInit PeopleCode when it
loads record from the database. However, in some cases, the
record can be initialized entirely from the keys for the
component. when this happens, RowInit PeopleCode isn’t
executed.
67
PeopleCode Events
RowInit
Example
Suppose you have a field called PRODUCT.
The value of PRODUCT is field A * field B.
When component is initialized or new row is inserted, we use
RowInit PeopleCode to initialize PRODUCT equal to A*B .
We could then attach FieldChange PeopleCode programs to both
A and B which also set PRODUCT equal to A*B.
Whenever end user changes the value of either A or B,PRODUCT
would be recalculated
68
RowInit Event
69
RowInit Event
70
PeopleCode Event – PostBuild Event
MENU Activate
RowInit
Row Actions?
71
PeopleCode Events
PostBuild Event
The PostBuild event fires only after all the other
component build events have been fired
72
PeopleCode Events
PostBuild
When is it fired?
The PostBuild event fires after all the other component
build events have fired.
73
PeopleCode Events
PostBuild
Where is it used?
This event is often used to hide or unhide pages.
74
PeopleCode Events
PostBuild
75
PostBuild Event
76
PostBuild Event
77
PostBuild Event
78
PeopleCode Event – Activate Event
MENU Activate
RowInit
Row Actions?
79
PeopleCode Event
Activate Event
80
PeopleCode Event
Activate Event
When it is fired?
81
PeopleCode Event
Activate Event
Where is it used?
Activate PeopleCode can only be associated with
pages.
The Activate event triggers any Activate PeopleCode
associated with the page processing.
82
PeopleCode Event
Activate Event
What is it used for?
The event used for security validation: such as,
enabling a field or hiding a scroll , enabling user to
programmatically control the display of that page
controls.
This event is used for component Build Processing –
Add Mode and Update Mode
83
PeopleCode Event
Activate Event
Restriction
84
Activate Event
85
Activate Event
86
PeopleCode Event – FieldEdit Event
MENU Activate
RowInit
Row Actions?
87
PeopleCode Events
FieldEdit
When is it fired?
The FieldEdit event fires on the specific field and row
that has just changed.
88
PeopleCode Events
FieldEdit
Where it is used?
FieldEdit PeopleCode can be associated with record
fields and component record fields.
89
PeopleCode Events
FieldEdit
90
PeopleCode Events
FieldEdit
Restrictions
If the validation must check the contents of more than
one field, that is, if the validation is checking for
consistency across page fields, then SaveEdit
PeopleCode can be used instead of FieldEdit.
91
FieldEdit Event
92
FieldEdit Event
When the user tries to select the Department ID, a win message
will be displayed.
93
FieldEdit Event
94
FieldEdit Event
This is peopleSoft
generated warning ,
explaining that name field
is not valid. Just click ok
button to edit the name
field.
95
FieldEdit Event
96
FieldEdit Event
97
PeopleCode Event – FieldChange Event
MENU Activate
RowInit
Row Actions?
98
PeopleCode Events
FieldChange
When is it fired?
99
PeopleCode Events
FieldChange
Where is it used?
FieldChange PeopleCode is used to
Recalculate field values.
To change the appearance of page controls.
To Process the result from FieldChange other
than the data validations.
100
PeopleCode Events
FieldChange
What is it used for?
FieldChange PeopleCode is often paired with RowInit
PeopleCode.
In RowInit / FieldChange, the RowInit PeopleCode
check the values in the component and initializes the
state or value of page controls accordingly.
FieldChange PeopleCode then rechecks the values in
the component during execution and resets the state
or value of the page controls0.
101
PeopleCode Events
FieldChange
Restrictions
It is not recommended to have Error or Warning
statement in FieldChange PeopleCode. It is suggested
that all data validation should be performed in FieldEdit
102
PeopleCode Events
FieldChange event
Example
Suppose you have a field called PRODUCT.
The value of PRODUCT is field A * field B.
When component is initialized or new row is inserted,
user uses the RowInit PeopleCode to initialize
PRODUCT equal to A*B .
User could then attach FieldChange PeopleCode
programs to both A and B which also set PRODUCT
equal to A*B.
When ever user changes the value of either A or B,
PRODUCT would be recalculated.
103
FieldChange Event
104
FieldChange Event
105
FieldChange Event
106
PeopleCode Event – PrePopup Event
MENU Activate
RowInit
Row Actions?
107
PeopleCode Event
PrePopup Event
108
PeopleCode Event
PrePopup Event
When is it fired?
109
PeopleCode Event
PrePopup Event
Where is it used?
PrePopup PeopleCode can be associated with record
fields and component record fields .
110
PeopleCode Event
PrePopup Event
111
PeopleCode Event
PrePopup Event
PrePopup Processing
112
PrePopup Event
113
PrePopup Event
114
PrePopup Event
115
PrePopup Event
116
PeopleCode Event – ItemSelected Event
MENU Activate
RowInit
Row Actions?
117
PeopleCode Events
ItemSelect Event
118
PeopleCode Events
ItemSelect
When is it fired?
119
PeopleCode Events
ItemSelect
Where is it used?
120
PeopleCode Events
ItemSelect
121
PeopleCode Events
ItemSelect
Restrictions
122
ItemSelected Processing
123
ItemSelect Event
124
ItemSelect Event
125
ItemSelect Event
Menu Items
126
ItemSelect Event
127
PeopleCode Event – RowInsert Event
MENU Activate
RowInit
Row Actions?
Insert Delete
PostBuild
RowInsert RowDelete
128
PeopleCode Events
RowInsert
When is it fired?
The RowInsert triggers PeopleCode on any field on the
inserted row of data.
129
PeopleCode Events
RowInsert
Where is it used?
RowInsert PeopleCode can be associated with record
fields and component records.
130
PeopleCode Events
RowInsert
131
PeopleCode Events
RowInsert
Restrictions
Do not put PeopleCode in RowInsert that already exists
in RowInit, because RowInit event always fires after the
RowInsert event, which will cause your code to be run
twice.
Do not use a warning or Error in RowInsert, this will
cause a runtime error and force cancellation of the
component.
132
RowInsert Event
133
RowInsert Event
134
RowInsert Event
135
PeopleCode Event – RowDelete Event
MENU Activate
RowInit
Row Actions?
Insert Delete
PostBuild
RowInsert RowDelete
136
PeopleCode Event
RowDelete Event
The RowDelete event fires whenever an end-user
attempts to delete a row of data from a page scroll
137
PeopleCode Event
RowDelete Event
When is it fired?
138
PeopleCode Event
RowDelete Event
Where is it used?
139
PeopleCode Event
RowDelete Event
140
PeopleCode Event
Restrictions:
141
PeopleCode Event
142
PeopleCode Event
RowDelete Event
Logic of row delete processing
143
PeopleCode Event
RowDelete Event
Errors and Warnings in RowDelete
When you delete a row of data (F 8), the system
prompts you to confirm. If you do confirm, RowDelete
PeopleCode takes place, Errors and warnings in
RowDelete display a message box.
144
RowDelete Event
The record with employee number 10050 has been stored with the
Serial number 2
145
RowDelete Event
146
RowDelete Event
147
RowDelete Event
The delete action will occur when the transaction get saved
148
RowDelete Event
149
PeopleCode Event – SaveEdit Event
MENU Activate
RowInit
Row Actions?
150
PeopleCode Event
SaveEdit Event
The SaveEdit event fires whenever the end-user
attempts to save the component.
151
PeopleCode Event
SaveEdit Event
When is it fired?
SaveEdit Event gets Fired when
The user directs the system to save a component
by clicking Save or by pressing ALT+F1, then
ENTER.
152
PeopleCode Event
SaveEdit Event
Where is it used?
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.
153
PeopleCode Event
SaveEdit Event
What is it used for?
When the SaveEdit Event gets fired, the PeopleCode
in the event is get executed .
154
PeopleCode Event
155
PeopleCode Event
156
SaveEdit Event
157
SaveEdit Event
158
PeopleCode Event – SavePreChange Event
MENU Activate
RowInit
Row Actions?
159
PeopleCode Event
160
PeopleCode Event
SavePreChange Event
When is it fired?
The SavePreChange event fires after SaveEdit
completes without errors.
161
PeopleCode Event
SavePreChange Event
Where is it used?
SavePreChange PeopleCode can be associated
with record fields, components, and
component records.
162
PeopleCode Event
SavePreChange Event
What is it used for?
SavePreChange PeopleCode enables you to process
data after validation and before the database is
updated.
163
SavePreChange Event
SQL Commit
164
SavePreChange Event
165
SavePreChange Event
166
SavePreChange Event
167
PeopleCode Event – PostBuild Event
MENU Activate
RowInit
Row Actions?
168
PeopleCode Event
Workflow Event
169
PeopleCode Event
Workflow Event
When is it fired?
Workflow PeopleCode executes immediately after
SavePreChange and before the database update
that precedes SavePostChange.
The program should deal with Workflow only after
170
PeopleCode Event
Workflow Event
Where is it used?
Workflow PeopleCode can be associated with
record fields and components
Workflow PeopleCode is not field-specific: it
171
PeopleCode Event
Workflow event
172
WorkFlow Event
173
WorkFlow Event
Save it.
174
WorkFlow Event
175
WorkFlow Event
176
PeopleCode Event – SavePostChange Event
MENU Activate
RowInit
Row Actions?
177
PeopleCode Event
SavePostChange Event
178
PeopleCode Event
SavePostChange Event
When is it fired?
The SavePostChange Event is fired after the
Workflow Event is executed successfully.
179
PeopleCode Event
SavePostChange Event
Where is it used?
180
PeopleCode Event
SavePostChange Event
What is it used for?
The SavePostChange event, triggers any Workflow
PeopleCode associated with a record field or a
component.
181
PeopleCode Event
SavePostChange Event
Restriction
An Error or Warning in SavePostChange PeopleCode
causes a runtime error, forcing the end-user to cancel the
component without saving changes. Avoid Errors and
Warnings in this event.
182
SavePostChange Event
183
SavePostChange Event
184
SavePostChange Event
185
SavePostChange Event
186