Monday 23 June 2014

How to implement PeopleSoft Simple Person Search in our application?

Overview:

Most of the times while designing and building our custom pages, where we need to provide the users with a prompt to select person (active/inactive, employee/contingent worker/POI etc.) we end up either using some delivered or defining our own prompt table and using it. A more elegant alternative is to use PeopleSoft “Simple Person Search”. 

 Quite a few of the PeopleSoft delivered components use this functionality.  So it will be a good idea to incorporate it in our custom components to give the end users similar user experience which is the key to any of the bolt-on application that we design.

This small configuration component available at (Set Up HRMS, Common Definitions, Person Search Match, Configure Simple Person Search, Configure Simple Person Search) enables users of an application to search for and select a person to process.

Some of the advantages of using this option are
  • An application can easily render a UI that prompts the user for partial names and displays a list of person from which the user can select
  • Configurable multiple person select option
  • Configurable HR Status (active/inactive) option
  • Configurable Per Org(Employees/Contingent workers/Person of Interest) option
  • Optional drill-down to additional non-sensitive data
  • The configuration is keyed by “Object Owner Id” which further provides the flexibility to use different configuration for different components

Example:

  • In this example there is a hyperlink in a page as shown below
  • On clicking this hyperlink the user sees the below Person Search Page. The search options available are configurable from the setup page.
  • The user can use the above search options to search for person. The selection of person from the search result can then be tied back to the page from which Person Search page is launched.

Steps to do it:

  • We add our own Object Owner Id value.  To do that we need to add a translate value to the field OBJECTOWNERID from the following navigation:  Main Menu > PeopleTools > Utilities > Administration > Translate Values. In the screenshot below we have created an Object Owner Id value “SOA”


  • Next we have to Configure Person Search page for the Object Owner Id value created above by navigating to Main Menu > Setup HCM > Common Definitions > Person Search Match > Configure Simple Person Search. The details of the configuration options can be found in the PeopleBook - Person Search 


  • Once we are done with the configuration we can test the Person Search configuration for our Object Owner Id by navigating to Main Menu > Setup HCM > Common Definitions > Person Search Match > Invoke Person Search API


  • Technical Design

  1. We add HR_PSS_DUMMY_FIELD of DERIVED_PSS record in level 0 of the page. This is a requirement for using the Simple Person Search functionality
  2. We need to add another field at suitable level in the page which will act as the hyperlink which the user clicks to launch the Simple Person Search page
  3. We need to use” PersonSearchSimpleUI” class, which belongs to Application Package HR_PERSON_SEARCH_SIMPLE
  4. Within the field change event we instantiate the above mentioned class
  5. We call SelectPeople () method to make this Search Page work. This method returns an array String (Employee IDs)
  6. We need to then traverse through the array to get the employees and do the rest of the processing
  7. We can also do some more manipulations by using several properties of the class. For example: to restrict selecting multiple employees from the search page we have to make MultiSelect property of the object as False.
  8. Find below the Field Change PeopleCode for reference. Please note that the below code is for selecting only one person from the result set and assigning it to the field SOA_RECOG_ID.EMPLID

/********************************************************************************/
/* We have used custom Text Catalog (OwnerID: SOA )for the page formatting & all*/
/*Import the  Application Class*/
import HR_PERSON_SEARCH_SIMPLE:PersonSearchSimpleUI;
/*Declare the Object of the class*/
Global  HR_PERSON_SEARCH_SIMPLE:PersonSearchSimpleUI &PersonSearchSimpleUI;
/*Object instantiation*/

If &PersonSearchSimpleUI <> Null Then
   If &PersonSearchSimpleUI.propObjectOwnerID <> "SOA" Or
         &PersonSearchSimpleUI.propSubID <> " " Then
      &PersonSearchSimpleUI = create HR_PERSON_SEARCH_SIMPLE:PersonSearchSimpleUI("SOA", " ");
   End-If;
Else
   &PersonSearchSimpleUI = create HR_PERSON_SEARCH_SIMPLE:PersonSearchSimpleUI("SOA", " ");
End-If;
/* Accessing Methods declared in the class. This method helps in Selecting the employee from the search page*/
&arrEmplids = &PersonSearchSimpleUI.SelectPeople();
/*Traverse through the loop and read the employee id in the EMPLID field*/
For &j = 1 To &arrEmplids.Len
   If &arrEmplids [&j] = %EmployeeId Then
      Error ("Self Recognition is not permissible");
   Else
     SOA_RECOG_ID.EMPLID.Value = &arrEmplids [&j];
End-If;
End-For;
/*********************************************************************/

Contributed by Sourav Pal

No comments:

Post a Comment