A very handy PeopleCode function to check for a user role(s) and perform specific actions depending on the value returned.
Title | Under | Posted on |
---|---|---|
Component interface Error: no rows exist for the specified keys | PeopleSoft Technical | 03/15/2019 - 3:54am |
ADD 24 months starting from current month.(peoplesoft) | PeopleSoft Functional | 07/29/2018 - 8:44pm |
TRC values dropdown | PeopleSoft Technical | 04/04/2018 - 12:54am |
how to find missing sequence in GRID and print the mising sequence number while saving through peoplecode | PeopleSoft Technical | 09/11/2017 - 4:49am |
Comments
There also exists a PeopleCode function "IsUserInRole" (and also "IsUserInPermissionList").
Bart, thanks for pointing out the functions. I guess this will shrink the above code to 1 line! And to follow up on your comment here is the syntax and little explanation for each of the functions.
IsUserInRole
IsUserInRole(rolename1 [, rolename2]. . .)
Returns True if the current user belongs to one or more role specified in the role array, otherwise it returns false.
IsUserInPermissionList
IsUserInPermissionList(PermissionList1 [, PermissionList2]. . .)
Returns True if the current user has access to one or more permission list specified in the passed array, otherwise it returns false.
Thanks again Bart!
Yes, I agree tht IsUserInRole is a very handy function.
I've used it as given below:
If (&PrevAct = "LOA" And
ACTION <> "RFL") And
Not (IsUserInRole("MBT_JOB_SUPERUSER_VALIDATION")) Then
Error (MsgGetText(20000, 533, ""));
End-If;