Tuesday, February 15, 2011

PeopleCode Bypass Search Page by Role

 

Sometimes you would like to bypass the search page depending on the user's role. For some users, they need the ability to look at other employee’s time sheets, managers for example. However, for others, they should only be restricted to their own data. Below is PeopleCode example that will bypass the search page depending on users' role.

&FLAG_ROLE = "Y";
For &I = 1 To %Roles.Len;
If %Roles [&I] = "CSR" Or
%Roles [&I] = "Operations Service Centre" Then
&FLAG_ROLE = "N";
/*Allow this person to enter the search page*/
SetSearchDialogBehavior(1);
/*Unhide name for user to be able to search */
UnHide(your_search_record_onthe_component.NAME);
End-If;
End-For;
If &FLAG_ROLE = "Y" Then
your_search_record_onthe_component.EMPLID = %EmployeeId;
/*Hide emplid and name so user can not search*/
Hide(your_search_record_onthe_component.EMPLID);
Hide(your_search_record_onthe_component.NAME);
/* skip search page */
SetSearchDialogBehavior(0);
AllowEmplIdChg( True);
End-If;

0 comments:

Post a Comment