Stop Using Page Activate PeopleCode

By Chris Malek | Wed, May 11, 2011

I think the Page Activate PeopleCode event is evil. There are many delivered components from Oracle that actually use this event to do extensive processing and to load buffer data. So I see developers mimic this design and use it in their code structure.

Generally, when I see people use this event they just need some piece of code to fire once before the user sees the page and after all the buffer data has loaded. The Page Activate event does indeed accomplish this goal but there is a better way.

  • Using the Page Activate event for buffer loading and manipulation works when you have one page in the component. What happens when later someone decides to add another page to the component? This can cause some serious issues if you are doing buffer manipulation. The reason is that every time the user tabs between pages in the component, the Page Activate event fires. This could result in data loss if you are flushing component buffers and reloading every time the user looks at the page and the user may not even know they lost their data. Additionally, you are causing unneeded database processing because there is no need to reload the buffer when the user flips between pages.
  • Another important issues is that the Page Activate event does not trigger when the component is being invoked via a Component Interface. So if you think there is ever a time where you will need to load data into the Component with a CI you should not even put any core logic in the page activate event.

Alternative Design

So what should you use instead?

  • Most of the time you should put your code in the Component PostBuild event. This event fires once for the component and towards the very end after all the data has been loaded into the buffer. This is a great place to hide fields, pull data from the database, disable fields, etc.

Most of the code that I see people put in the Page Activate event will actually be better served in the Component PostBuild event.


One exceptions where you may want to use Page Activate PeopleCode is if you have a few pages in the component and one of those pages is rarely viewed and the data on that page is “expensive” in cpu terms to load or calculate. In this case you could put that complex code in Page Activate so it only fires when a user wants to look at that data. This could also be done using a push button on the page with some warning about “please be patient while we load the expensive data.”

Author Info
Chris Malek

Chris Malek is a PeopleTools® Technical Consultant with two decades of experience working on PeopleSoft enterprise software projects. He is available for consulting engagements.

About Chris Work with Chris
Looking for pain-free PeopleSoft web services? 😀
PeopleSoft Simple Web Services (SWS)

Introducing a small but powerful PeopleSoft bolt-on that makes web services very easy. If you have a SQL statement, you can turn that into a web service in PeopleSoft in a few minutes.

Integration Broker - The Missing Manual

I am in the process of writing a book called "Integration Broker - The Missing Manual" that you can read online.