Hide Fields on PeopleSoft Page for Some Users

Your rating: None Average: 4 (3 votes)

Sometimes you would like to hide fields from some users and not others. The only way that I know of is by creating a new role and assigns it to users who should not be seeing the fields.

This is how to go about doing that:

  1. Create a role and add the users that should not see the fields to this role. The role doesn't have to have any permission list(s), although it could if you want to, it really doesn't matter for what we are trying to do here.
  2. In the page.activate PeopleCode event, right some code to test if the user opening the page is in that role. If so, then hid the fields.

There is a delivered PeopleSoft function that checks if a user has a specific role.

&role_found = %RolesFind("Your_Role");
rem -- 0 = role not found;
If &role_found <> 0 Then
rem -- hide your fields;
End-If;

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
RG's picture
RG (not verified)
Re: Hide Fields on PeopleSoft Page for Some Users

The first line of code should read
&role_found = %Roles.Find("Your_Role");

Thanks.

Guest's picture
Guest (not verified)
Re: Hide Fields on PeopleSoft Page for Some Users

you can do like this
if IsUserInRole("rolename") then
record.field.visible = false;
end-if;