9 Replies Latest reply: Jun 27, 2012 10:42 AM by 946139 RSS

    PeopleSoft Search Page Results Filtering

    930070
      I have three fields on a custom search page.
      EMPLID, FIRST_NAME, SUPERVISOR_ID each having a look-up table.

      The values of EMPLID are populated from the view VW1, FIRST_NAME from VW2, SUPERVISOR_ID from VW3 based on person who logged in.

      Now when I login as a manager and click the look-up next to "SUPERVISOR_ID" and select a supervisor. Then when I click the "look-up" next to EMPLID the system provides me all the results. (Which I understand that they are drawn from VW1)

      Example: I login as a Sr.Manager.

      I have 10 people in SUPERVISOR_ID
      50 in EMPLID
      Same 50 in FIRST_NAME

      How do I customize so that, for example I select SUPERVISOR_ID as "11111" from the 10 values. Then when I click look-up next to EMPLID, I should only see people reporting to "11111". As of now the search fields are not filtering the records based on values in other fields, I could see all 50?

      Any thoughts?
        • 1. Re: PeopleSoft Search Page Results Filtering
          HakanBiroglu
          PeopleSoft automatically uses higher level keys in prompts.

          What you should do is the following:
          Add SupervisorId as the first field on your searchrecord with any prompt.
          Add Emplid to your search record with a prompt on an view where SupervisorId and Emplid are SearchKeys.

          When you first choose a SupervisorId and then click on the prompt of the Emplid, PeopleSoft will automatically copy the SupervisorID from your searchrecord to the SupervisorID field of the prompt on Emplid.

          Hakan
          • 2. Re: PeopleSoft Search Page Results Filtering
            930070
            What I did was...

            VW1 (view that gives results for SUPERVISOR_ID)....fields order are
            OPRID, SUPERVISOR_ID, EMPLID, NAME.....with first three as keys and search keys.

            VW2 (view that gives results for EMPLID)....fields order are
            SUPERVISOR_ID, EMPLID, OPRID, EMPLID, NAME.....with first three as keys and search keys.

            Example:
            When I login and click on look-up next to SUPERVISOR_ID....I see 15 supervisors including me (Consider 1 to 15). I selected supervisor 5...its not me (who has 10 employees reporting to him). Then I click on look-up next to EMPLID, I expect to see only employees who report to supervisor 5 (i.e 10 employees), but I see all the employees in the organization now?

            Edited by: user10608124 on Jun 7, 2012 10:10 AM
            • 3. Re: PeopleSoft Search Page Results Filtering
              HakanBiroglu
              Whenever you add OPRID to a record and this is a key, PeopleSoft will automatically take the oprid of the current user logged on and expand the view with the where clause:

              AND OPRID = %OPERATORID

              This automatically selects only the data you are allowed to see, most often used in row level security. If you want to see all data, delete OPRID from the record.

              I just tried to reproduce your situation, and this is what I did (simple example to make it clear).

              Record 1 L_JOB_SUPER_VW (select all supervisors)
              1 Field:
              SUPERVISOR_ID, key, search key
              SQL:
              SELECT DISTINCT A.SUPERVISOR_ID
              FROM PS_JOB A
              WHERE A.EMPL_STATUS = 'A'
              AND A.EFFDT = (
              SELECT MAX (C.EFFDT)
              FROM PS_JOB C
              WHERE C.EMPLID = A.EMPLID
              AND C.EMPL_RCD = A.EMPL_RCD
              AND C.EFFDT <= %CurrentDateIn)
              AND A.EFFSEQ = (
              SELECT MAX(D.EFFSEQ)
              FROM PS_JOB D
              WHERE D.EMPLID = A.EMPLID
              AND D.EMPL_RCD = A.EMPL_RCD
              AND D.EFFDT = A.EFFDT)
              AND HR_STATUS = 'A'

              Record 2 L_JOB_SUP_EMPL (select all supervisors and employees)
              2 Field:
              SUPERVISOR_ID, key, search key
              EMPLID, key, search key
              SQL:
              SELECT A.SUPERVISOR_ID
              , EMPKID
              FROM PS_JOB A
              WHERE A.EMPL_STATUS = 'A'
              AND A.EFFDT = (
              SELECT MAX (C.EFFDT)
              FROM PS_JOB C
              WHERE C.EMPLID = A.EMPLID
              AND C.EMPL_RCD = A.EMPL_RCD
              AND C.EFFDT <= %CurrentDateIn)
              AND A.EFFSEQ = (
              SELECT MAX(D.EFFSEQ)
              FROM PS_JOB D
              WHERE D.EMPLID = A.EMPLID
              AND D.EMPL_RCD = A.EMPL_RCD
              AND D.EFFDT = A.EFFDT)
              AND HR_STATUS = 'A'

              Record 3 L_SRCH_SUP_EMPL (used as search record on component)
              2 Fields:
              SUPERVISOR_ID, key, search key, prompt L_JOB_SUPER_VW
              EMPLID, key, search key, prompt L_JOB_SUP_EMPL

              Now when I open the component I have two fields, SupervisorID and Emplid. When I click on the prompt for field SupervisorID, I can select all supervisors. When I choose an supervisor and after this select click on the Emplid prompt, I will see that this has two fields in the prompt popup screen; SupervisorID, value copied from previous prompt and empty field emplid to be filled in by the user. So this second prompt will only select all employees that report to the choosen supervisorid.

              Does this help?

              Hakan
              • 4. Re: PeopleSoft Search Page Results Filtering
                930070
                Thanks Hakan!

                I completely get that. But, a manager at our organization should not be able to access all managers or employees. He/she should be able to access only their direct reports that's the reason I also introduced OPRID in both the views. This is why I'm still having the issue.
                • 5. Re: PeopleSoft Search Page Results Filtering
                  HakanBiroglu
                  Do you want to see the Supervisors that report to the user that is logged on?

                  In that case I would recommend using the more elegant vanilla Direct Reports functionality.

                  See for an example, or any MSS component
                  http://docs.oracle.com/cd/E28727_01/hcm91fp2/eng/psbooks/hhaf/img/sm_ExampleOfLocationChangePage7cb0_hhaf7cbf.png

                  See PeopleBooks on how to configure this.
                  PeopleBooks > PeopleSoft HCM 9.1 Application Fundamentals PeopleBook > Working with Common Components > Configuring Direct Reports Functionality

                  After setup of Direct Reports, add the following lines of code to your component PostBuild.
                  This will start the component with the Direct Reports selection pages instead of a search record.

                  /* Import DirectReports Classes */
                  import HR_DIRECT_REPORTS:DirectReportsUI;
                  import HR_DIRECT_REPORTS:DirectReports;

                  Local Rowset &RS_Employees;
                  Component date &WFASOFDATE;
                  Component HR_DIRECT_REPORTS:DirectReportsUI &myDirectReportsUI;

                  Component string &cSelectedEmplid;
                  Component number &cSelectedEmplRcd;

                  Global Record &gblREC_HR_DR_GBL_WRK;
                  Component Record &cmpREC_HR_DR_GBL_WRK;

                  /* Create the Global Direct Reports work record if none exists. This */
                  /* Global record is needed to be able to bypass the Direct Reports */
                  /* selection when returning to this component from another component. */
                  If None(&gblREC_HR_DR_GBL_WRK) Then
                  &gblREC_HR_DR_GBL_WRK = CreateRecord(Record.HR_DR_GBL_WRK);
                  End-If;

                  /* Set the Component Direct Reports work record = Global version. */
                  &cmpREC_HR_DR_GBL_WRK = &gblREC_HR_DR_GBL_WRK;

                  /* Instantiate and invoke UI for employee selection */
                  &myDirectReportsUI = create HR_DIRECT_REPORTS:DirectReportsUI();
                  &myDirectReportsUI.ShopForEmployees();

                  /* Populate the list of employees */
                  &RS_Employees = GetLevel0();
                  &myDirectReportsUI.CopyShoppingCartToRowset(&RS_Employees);

                  /* Copy selected employee to Component variables */
                  &cSelectedEmplid = &cmpREC_HR_DR_GBL_WRK.EMPLID.Value;
                  &cSelectedEmplRcd = &cmpREC_HR_DR_GBL_WRK.EMPL_RCD.Value;

                  /*Copy as of date to Component variables */
                  &WFASOFDATE = &myDirectReportsUI.AsOfDate;

                  Now you can use the selected Employee to build up level 0.

                  This might look complex, but this is also the way Vanilla PeopleSoft MSS works and it would be great is your customization's look an feel like Vanilla PeopleSoft.
                  For an example just open any MSS component.

                  Hakan
                  • 6. Re: PeopleSoft Search Page Results Filtering
                    656825
                    I think what Hakan said is correct, you just add more keys as you go down a level.
                    Maybe you have an issue because the order of the keys has changed between L1 and L2? OPRID should remain the first key for your search record prompt.
                    • 7. Re: PeopleSoft Search Page Results Filtering
                      946139
                      I appear to be having a similar issue - have a table of 6 fields - only 4 of which really need to go in the grid - have two fields at level 0 - emplid and empl_rcd - have in the grid at level 1, emplid, empl_rcd, field 3 and field 4 on my grid.

                      Have copied the code from this posting into my component postbuild peoplecode. When I run the my component I am picking up first, my originial table as the search record - I then select a record, then I get the HR_DR_SELECTION_UI component, click thru to the employee selection screen (have setup under Direct Reports Manger UI (but I do not have a transaction name associated only the component), select an employee (different from my originial search screen) and I get the Employee ID at level 0 for the employee that I selected from the HR_DR_SELECTION_UI process, but my records in the grid is based on my employee selection from my search record and not the Component Interface.

                      How do I first, get rid of the originial search screen and only use the component UI and then second, how do I get my Grid to populate with the data for the appropriate selected emplid from the Component UI?
                      • 8. Re: PeopleSoft Search Page Results Filtering
                        HakanBiroglu
                        >
                        How do I first, get rid of the originial search screen and only use the component UI and then second,
                        >
                        Hmm, this I have never seen.
                        Have you setup you component to use Direct Reports?
                        Main Menu > Set Up HRMS > Common Defenitions > Direct Reports For Managers > Direct Reports Setup
                        Also make sure that Force Search Processing is not checked at the Component.

                        >
                        how do I get my Grid to populate with the data for the appropriate selected emplid from the Component UI?
                        >

                        Set the grid to NoAutoSelect and populate the grid at PageActivate or PostBuild event after you selected the Employee, using PeopleCode.
                        Something like this.

                        GetLevel0()(1).GetRowSet(Scroll.YOURRECORD).Select(Record.YOURRECORD, "WHERE EMPLID = :1 and EMPL_RCD = :2", &cSelectedEmplid, &cSelectedEmplRcd);

                        Edited by: Hakan Biroglu on Jun 27, 2012 3:21 PM
                        • 9. Re: PeopleSoft Search Page Results Filtering
                          946139
                          Yes the component is setup in Direct Report Setup as well as Configure Direct Reports UI and Force Search Processing is not check for the component search record. I have set the check box for No Auto Select and am attempting to work thru the Page Activate peoplecode at this time to no avail. I am still getting my default search popping up first and then the Component UI search and selection - still does not populate the grid correctly.