There are a lot of events in PeopleSoft, like SaveEdit, SavePreChange, SavePostChange, etc. Each event is associated with certain objects (Page, record, or record field). Starting from People Tools 8.48, component buffer is introduced into the system, which makes the situation more complicated. For example, if we have certain codes want to add into the save edit event, we have several choices, such as attach the code to record field, or attach the code to component record. Definitely the place is determined by your business needs. But it will always be good to know what is the detailed execution order for codes attached to different places. And this article is written to clarify this.
Let’s start with a detailed example. A few new records and fields are created like this, namely R0,R1 and R2:
Then, we create a page which is using these three records
And create a new component which has only this page, we call it C1.
Now, we put test codes into several places and test the execution order. We will use the standard notation to represent different events, such as R0.F0.SEd will indicate that the event is on record field F0 in record R0 and the event is Save edit. In each event, we just put one line to let it pop up a messaging. By this, we can tell the order of execution. The line can be this:
1: WinMessage("I am R0.F0.SEd", 0);
2:
We add that code to 11 events as the following:
- R0.F0.SEd
- R1.F1.SEd
- R2.F2.SEd
- R2.F3.SEd
- C1.R0.SEd
- C1.R1.SEd
- C1.R2.SEd
- R2.F2.SPr
- R2.F2.Wrk
- R2.F2.SPo
- R2.F3.SPo
Now the question becomes “What is the execution order of the 11 events”?
To test the result out, it is easy. We can just continue with the set up above. After building all the records and register the component C1 into the portal. We can just import some data to test it out.
1: insert into PS_R0 values ('1');
2: insert into PS_R1 values ('1','2');
3: insert into PS_R2 values ('1','2','3','4');
4: commit;
Then we can just open the page and change any value , then click save. And now you have the order.
The execution order will be
- R0.F0.SEd
- C1.R0.SEd
- R1.F1.SEd
- C1.R1.SEd
- R2.F2.SEd
- R2.F3.SEd
- C1.R2.SEd
- R2.F2.SPr
- R2.F2.Wrk
- R2.F2.SPo
- R2.F3.SPo
But why the execution order comes out like this?
Rule 1:
First of all, the execution order is determined by component buffer process sequence, which can be demonstrated by the follow chart:
Based on the flow chart, the primary order will follow the process sequence, all SaveEdit events will be executed before SavePreChange event.
Rule 2:
Rule 3:
The three rules sum up the basis how the event execution order is determined. Another way to understand this is , you have a table of events which are going to be executed like this:
Pending Event | Event Process Sequence | Event Level | Tab Order |
R2.F2.SEd | 1 (SEd) | 1 (Record) | 5 |
C1.R1.SEd | 1 (SEd) | 2 (Component) | 4 |
R2.F2.SPr | 2 (SPr) | 1 (Record) | 5 |
Then the order of execution can be expressed as the following SQL statement:
1: Select pending_event from TABLE order by Event_Process_Sequence, Tab_Order, Event_Level
This clarifies the rules to determine the execution order.
If you interested, you can download the test project from HERE. Build the record, import the data, and register the component by yourself to test it out. Good luck. ^_^