Skip to main content
Inspiring
Sep 19, 2023 1:20 PM UTC
Solved

pickerFieldUsers - remove loggedin user

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: {}
                  )

    stefanhelzle0001
    Brainy
    Sep 19, 2023 1:54 PM UTC

    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
    Sep 19, 2023 1:54 PM UTC

    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
    Sep 19, 2023 1:55 PM UTC

    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