Bridging the gap to Fusion through our PeopleSoft Solutions Extenders
Grey Sparling PeopleSoft Expert's Corner
Oracle Blogs
 Subscribe Now!
Interact with the experts here at Grey Sparling Solutions, Inc.

Wednesday, October 10, 2007

Opening up a Performance or Development Document from a URL

I've recently been spending a bit of time working in HR on a Co-Presentation with Business Objects for their upcoming conference this week. One of the things I wanted to show was how to open up a performance review or a development plan from a report. Unfortunately, the pages in HCM don't allow you to pass in an EMPLID or a Review Type to open it up.

The Solution

The solution is similar in nature to what I did for navigating to values in the Journal Entry page. I used the %Request.GetParameter() function to allow the URL to navigate to the page to contain the extra parameters I needed. I then used the parameters to find the document I wanted to open, and opened it. I ended up need needing to add code to two different locations to make it work (mainly because the performance documents were written as several different components that transfer the user around):

  • The first was to add Page.Activate PeopleCode to the EP_LAUNCH page. This code accepts the parameters passed on the URL. Because those parameters will be lost after a transfer event, it puts them into global variables to be used later.
  • The second is to modify the Page.Activate PeopleCode of the EP_APPR_SELECT page to use the parameters passed on the command line to walk through the list of documents and open the appropriate one.

In case you were wondering what the navigation would look like, here are a couple of URLS that would open up the appropriate documents.

The first is a URL to open an annual performance document (for employee KU0065): http://www.gsdemo.com/psp/ps/EMPLOYEE/HRMS/c/ROLE_MANAGER.EP_CURRENT_MY_PRF.GBL?&PAGE=EP_APPR_SELECT&EMPLID=KU0065&EP_REVIEW_TYPE=K0ANNUAL

The second URL opens up a development document (for employee KU0119): http://www.gsdemo.com/psp/ps/EMPLOYEE/HRMS/c/ROLE_MANAGER.EP_CURRENT_MY_DVL.GBL?&PAGE=EP_APPR_SELECT&EMPLID=KU0119

Here's the code needed on the Page.Activate program within the EP_LAUNCH page:

Because this page doesn't already have PeopleCode here, you can simply copy and paste the following code(tested against HCM 8.9).

/* ********************************************************** */
/* Grey Sparling - Add Code to Open up an item passed on URL */
/* ********************************************************** */

rem Grey Sparling - Retrieve Parameters to open up employee;
Global string &gsEmplID;
Global string &gsRevType;

&gsEmplID = RTrim(%Request.GetParameter("EMPLID"));
&gsRevType = RTrim(%Request.GetParameter("EP_REVIEW_TYPE"));

Here's the code needed on the Page.Activate program within the EP_APPR_SELECT page:

The first step is to declare the global variables near the top of the program. It already contains the declaration for &EP_GBLKEYS_WRK. You should put the following lines above it.

/* Grey Sparling - Declare Globals */
Global string &gsEmplID;
Global string &gsRevType;

The rest of the code should be appended to the end of the page activate peoplecode on the EP_APPR_SELECT page.

/* ********************************************************** */
/* Grey Sparling - Add Code to Open up an item passed on URL */
/* ********************************************************** */

If None(&gsEmplID) Then

    &gsEmplID = RTrim(%Request.GetParameter("EMPLID"));

End-If;
If None(&gsRevType) Then
    &gsRevType = RTrim(%Request.GetParameter("EP_REVIEW_TYPE"));
End-If;

rem Grey Sparling - If EMPLID is passed, walk through the rowset to find it;
If All(&gsEmplID) Then
    Local Rowset &rsEPApprSelect = GetLevel0().GetRow(1).GetRowset(Scroll.EP_APPR_SEL_VW);

    Local number &j;
    For &j = 1 To &rsEPApprSelect.ActiveRowCount

      Local Row &rowTest = &rsEPApprSelect.GetRow(&j);

      rem Grey Sparling - Test passed in parameter against current row's emplid;
      If &rowTest.GetRecord(Record.EP_APPR_SEL_VW).GetField(Field.EMPLID).Value = &gsEmplID Then
        Local string &rsRevType = RTrim(&rowTest.GetRecord(Record.EP_APPR_SEL_VW).GetField(Field.EP_REVIEW_TYPE).Value);

        rem Grey Sparling - If there's no reivew type parameter or if there is and parameter matches for current row, open up document;
        If None(&gsRevType) Or
          &rsRevType = &gsRevType Then

          /* Transfer the user to the selected review sub-document */
          &EP_GBLKEYS_WRK.EMPLID.Value = &rowTest.GetRecord(Record.EP_APPR_SEL_VW).GetField(Field.EMPLID).Value;
          &EP_GBLKEYS_WRK.EP_APPRAISAL_ID.Value = &rowTest.GetRecord(Record.EP_APPR_SEL_VW).GetField(Field.EP_APPRAISAL_ID).Value;
          TransferPage(Page.EP_APPR_DETAIL);
          Break;

        End-If;
      End-If;
    End-For;
End-If;

In case you saw this post prior to October 12, 2007, you may have noticed that it's different (and the original posting didn't work). I apologize for that, and now that I understood the way that global variables worked in the design of the application, I was able to figure out that I needed to test by establishing completely new sessions to ensure that prior runs didn't utilize previously set global variables.

Labels: , ,

0Comments:

Post a Comment

<< Home