Skip to main content
September 19, 2023
Solved

pickerFieldUsers - remove loggedin user

  • September 19, 2023
  • 2 replies
  • 0 views

Hi Team,

I have group - Group1

In the group 1, we have 3 users

user1, user2, and user3.

Now, I have loggedin with user1 account. In the pickerField now the user1 should not be listed out.

Can you please help with the approach. 

a!pickerFieldUsers(
                    label: "Users",
                    labelPosition: "JUSTIFIED",
                    maxSelections: 5,
                    groupFilter: cons!Group1,
                    value: local!selectedApprovers,
                    saveInto: local!selectedApprovers,
                    required: true(),
                    validations: {}
                  )

    Best answer by stefanhelzle0001

    You cannot filter the list of users you can choose from, but you can add validation to avoid being able to pick yourself.

    2 replies

    stefanhelzle0001
    Brainy
    September 19, 2023

    You cannot filter the list of users you can choose from, but you can add validation to avoid being able to pick yourself.

    mikes0011
    Brainy
    September 19, 2023

    The best thing you can do here is to add a validation that displays a validation message when the current user is selected.  The second best thing to do (which would be slightly more automatic but could potentially introduce some confusion) would be to intercept the current user from even being saved by using a more advanced line of code in your saveInto parameter.  But honestly, I'd just go with the validation method.

    The Expression Guru