Hi I have a scenario in which user can select a user from a particula

Hi

I have a scenario in which user can select a user from a particular user group. I have used the function isusermemberofgroup() in the validations of pickerFieldUsers() which works as per desire when I am logged in as Admin.
My code is:
a!pickerFieldUsers(
label: "Select User : ",
labelPosition: "ADJACENT",
maxSelections:1,
value:ri!user,
saveInto:ri!user,
validations:if(isnull(ri!user),{},{if(isusermemberofgroup(ri!user,cons!USER_GROUP)," ","Please select the correct user")})
)
But when I log in as a basic user I get an error as:

Error evaluating function 'isusermemberofgroup' : PrivilegeException[null=>null]: Insufficient permission

Can anyone please suggest as to how to handle this scenario.

Thanks in advance!!

OriginalPostID-167775

OriginalPostID-167775

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Another way you can implement this is by using the groupFilter parameter to filter to only show users in that group and remove the validation since you won't be able to choose a user that's not in that group. This is a code snippet you can use:

    a!pickerFieldUsers(
    label: "Select User : ",
    labelPosition: "ADJACENT",
    maxSelections:1,
    value:ri!user,
    saveInto:ri!user,
    groupFilter:cons!USER_GROUP
    )
Reply
  • 0
    Certified Lead Developer
    Another way you can implement this is by using the groupFilter parameter to filter to only show users in that group and remove the validation since you won't be able to choose a user that's not in that group. This is a code snippet you can use:

    a!pickerFieldUsers(
    label: "Select User : ",
    labelPosition: "ADJACENT",
    maxSelections:1,
    value:ri!user,
    saveInto:ri!user,
    groupFilter:cons!USER_GROUP
    )
Children
No Data