Wednesday, April 22, 2009

Direct Reports UI and Peoplecode Transfer Function

The Transfer function is used in Peoplecode to move the users to a desired page within the same component or another component. A syntax for the function is as shown below(source Peoplebooks 8.48 - Peoplecode Language Reference) :


As shown above, the Menuname, Barname, Itemname and Page name of the target page has to be passed in this function. Rather than hard coding these values in the code, it will be a good practice if the above parameters are derived from a PIA page. Take a look at the page where we set up the Direct Reports Utility (Setup HRMS --> Common Definitions --> Direct Reports for Managers --> Direct Reports Setup).

The delivered Direct Reports Utility is designed to show the same employee selection page to the manager in various components and then is designed to redirect the manager to the appropriate page using the Transfer function. This functionality can be adopted for any custom requirement also. The parameters for the transfer function can be configured on this page and later retrieved Peoplecode by passing the component and market details (Use %Component and %Market as best practis). The only disadvantage I see is that if there are multiple transfer functions being used in the same custom component, then this is not a feasible solution. The elegance of the solution lies in the fact that nothing will have to be hardcoded in the transfer function code and is a completely maintainable and scalable solution.

No comments: