Detailed event execution order in PeopleSoft

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:

1

 

Then, we create a page which is using these three records

3

2

And create a new component which has only this page, we call it C1.

Snap5

 

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:

  1. R0.F0.SEd
  2. R1.F1.SEd
  3. R2.F2.SEd
  4. R2.F3.SEd
  5. C1.R0.SEd
  6. C1.R1.SEd
  7. C1.R2.SEd
  8. R2.F2.SPr
  9. R2.F2.Wrk
  10. R2.F2.SPo
  11. 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

  1. R0.F0.SEd
  2. C1.R0.SEd
  3. R1.F1.SEd
  4. C1.R1.SEd
  5. R2.F2.SEd
  6. R2.F3.SEd
  7. C1.R2.SEd
  8. R2.F2.SPr
  9. R2.F2.Wrk
  10. R2.F2.SPo
  11. 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:

Snap6

Based on the flow chart, the primary order will follow the process sequence, all SaveEdit events will be executed before SavePreChange event.

 

Rule 2:

If the events are of the same level, e.g. all attached on record level. Then it will depends on the tab order on the page. e.g. R2.F2.SEd executes before R2.F3.SEd as F2’s tab order is 5 where F3’s tab order is 6.

 

Rule 3:

If the events are the same, record event will be executed prior to the component record event.e.g. R0.F0.SEd executes before C1.R1.SEd.

 

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. ^_^

posted @ 2012-08-13 13:23  lei1016cn  阅读(4166)  评论(0编辑  收藏  举报