Page and Component Interface: A Warning

By Chris Malek | Tue, May 19, 2015

Every once in a while, I stumble on some PeopleCode that looks like this:

If %PAGE = Page.PERS_CHKLST_MGMT2 then
    /* do something really important here */
    /* If this code does not fire there is bad side effects. */
End-if;

The developer intended to limit the scope of the code to trigger only when the current user is viewing a specific page. You generally see this on record level PeopleCode that could end up firing in many places. This is problematic on several fronts. However, the main issue is that:

  • When the component is “wrapped” with a Component Interface the %Page variable resolves to an empty string. Therefore, the “very important” code inside the If will never trigger.

There are a couple alternatives that could have been taken instead.

  • Use the %Component construct instead (less desirable)
  • Add code that should only trigger in a certain component to component level PeopleCode (most desirable)

I ran into this issue trying to wrap a Campus Solutions checklist page in a component interface and call it from a web service. I was left with no choice but to customize the delivered code because the logic inside the if really needed to fire.

Additional Reading

The Only PeopleCode events you should be using

Article Categories
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
Product
PeopleSoft Simple Web Services (SWS)
Do you need a quick way to create web services?

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.

Book
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.