3/28/2012

Manager Self Service Architecture

I had to create new functionnalities in Manager Self-Service, and I spent some time to understand how it was working, so I juged it would be nice to write my "discoveries".

First, we need to understand how the manager is linked to his employees.  This is done through the direct report configuration :

Set Up HRMS > Common Definitions > Direct Reports for Managers > Configure Direct Reports UI




We need to create a transaction which has the same name as the component of the new Manager Self-Service functionnality.  Then, we can choose the options to retrieve the Employees (Access Type, Displayed Fields, 1 or multiple employees, ...).



The next step to do is to copy another component's PostBuild and Prebuild Peoplecodes in order to call the HR_DR_SELECTION_UI, which is the component that is used to select the employee(s) to work on.  Note that the labels, titles and other texts on this component needs to be set up in the Text Catalog (Set Up HRMS > Common Definitions > Text Catalog and Notepad > Maintain Text Catalog)



What is important into the component's PostBuild are the following lines :

[...]
Component HR_DIRECT_REPORTS:DirectReportsUI &myDirectReportsUI;
[...]
/* 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);
[...]


Basically, when calling the ShopForEmployees method, the DirectReportsUI objects transfers to HR_DR_SELECTION_UI which asks for a date first and then list the employees available depending on the direct reports access type.  When the employee(s) is(are) selected, the users then clicks on "condinue" and the component is closed; this means that the user is sent back to the main component.  The next statements in the PostBuild are setting keys with the selected employee.

 One of the goal of my developments was to copy functionnalities available in Employee Self-Service to use them in Manager Self-Service.  For example, the pay-check functionality, or the modification of personal information (Addresses, Phones, Emergency Contacts).  In some cases, like for the Pay Check, it can be very difficult, even impossible, because the OPRID field is everywhere in the pages as a key.  For the personal information modification, the only main issue to workaround was the search record, which had the OPRID as a key and which has a SearchInit Peoplecode that defaults the EMPLID to %EmployeeId, the EMPLID associated to the current user.  I found a workaround : on the menu item, we can overwrite the Search Record :



Another interresting point to consider is the way that the data is transferred between the components.  The &gblREC_HR_DR_GBL_WRK variable is populated by &cmpREC_HR_DR_GBL_WRK when leaving a component and populates &cmpREC_HR_DR_GBL_WRK when entering the other component. It must be empty at any moment except before transferring to another component or when the component is built; if it is not, the "shop for employee" pages won't be displayed.

Global Record &gblREC_HR_DR_GBL_WRK;
Component Record &cmpREC_HR_DR_GBL_WRK;

/* Set the Component record for the Direct Reports Global version and */
/* reset the Global. This is needed to bypass the Direct Reports when *.
/* returning to the originating component, HR_EE_INF_MGR.             */
If All(&gblREC_HR_DR_GBL_WRK) Then
   &cmpREC_HR_DR_GBL_WRK = &gblREC_HR_DR_GBL_WRK;
   &gblREC_HR_DR_GBL_WRK = Null;
End-If;