Contextual Navigator

The PeopleSoft Navigator is a component that provides users a way to navigate the folders and pages within Portal Registry menu structure.

psNavBar_lastFolder Object

The Navigator is undoubtedly painful to use out of the box, however there are some great techniques offered by the community to enhance it:

I think the community-provided enhancements make the Navigator much more useable. One outstanding issue that Oracle or the community hasn’t addressed is the Navigator’s lack of contextual awareness in certain scenarios. See this MOSC idea for details.

As mentioned in the idea, the Navigator does not properly manage the current navigation position. For example, let’s say you deep link to the User Profiles page and then open the Navigator. You will be presented with the Root of the navigation structure instead of the actual folder (PeopleTools > Security > User Profiles) that the User Profiles Page resides in. This is very problematic because the user has no context of where they are if they decide to navigate elsewhere using the Navigator.

To achieve better contextual awareness within the Navigator, we need to enhance the management of the psNavBar_lastFolder object in the session storage of the browser. This object holds the Portal Registry Folder name of the last visited folder within the Navigator and it is what the Navigator uses to know the current navigation position.

psNavBar_lastFolder Object

The problem is that this object only ever gets updated when you drill down and open a Content Reference (CREF) using the Navigator. Direct navigations using deep links, Recent Places, Favorites, etc. will not update the psNavBar_lastFolder object with the name of the parent folder of the navigated page.

We can fix this by performing an Event Mapping on the NavBar Component Post Build Event.

Event Mapping NavBar

Contextual Nav Event

There are two main pieces of logic that will need to be implemented in the Event Mapped code:

  1. Use the %Request object to obtain the current URL of when the NavBar is clicked and use the Portal Registry API to find the CREF of the current URL

  2. Call AddOnLoadScript to inject JavaScript to set the psNavBar_lastFolder object value to the parent name of the obtained CREF

This will make it so that the Navigator will not have a stale (inaccurate) context when it is opened because the context gets refreshed every time the NavBar is clicked.

Here is the Application Class PeopleCode to be Event Mapped to the NavBar Component to achieve this functionality:

import PT_RCF:ServiceInterface;

class ContextualNavigator implements PT_RCF:ServiceInterface
   method execute();

   method GetLastNavFolder(&psCurrentUrl As string) Returns string;


Declare Function PortalOpen PeopleCode FUNCLIB_PORTAL.PORTAL_GEN_FUNC FieldFormula;

method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/

   Local string &sCurrentUrl = %Request.GetHeader("Referer");

   AddOnLoadScript("PTNavBarNavigator.SetLastNavFolder('" | %This.GetLastNavFolder(&sCurrentUrl) | "');");


method GetLastNavFolder
   /+ &psCurrentUrl as String +/
   /+ Returns String +/

   Local ApiObject &oPortal = PortalOpen();

   Local ApiObject &oCref = &oPortal.FindCRefForURL(&psCurrentUrl);

   If &oCref = Null Then
      Return "";

   Local string &sLastNavFolder = &oCref.ParentName;

   &oCref = &oPortal.FindFolderByName(&sLastNavFolder);

   /* Do not use the Folder if it is hidden from Portal Nav */
   While &oCref <> Null

      If Not (&oCref.IsVisible) Then
         Return "";

      &oCref = &oPortal.FindFolderByName(&oCref.ParentName);



   Return &sLastNavFolder;


Leave a comment

Your email address will not be published. Required fields are marked *