I've created a people picker control in my form. I want it to only allow 1 user to be entered at a time. So if there's 1 user already selected, clear that picker, then resole the added user.

On my OnUserResolvedClientScript I have:

                  (pickerId, user) => {
                        console.log("picker change event", pickerId, user);

                        // Update with last selected user id
                        let userEmail = user[0].EntityData.Email;

                        frb.d.user.get(userEmail).then(user => {
                            console.log("user", user);

                            let userId = user.data.Id;

                            // Update form component
                            let picker = pickerId.split("_")[0];

                            $(`#${picker}`).attr("value", userId);

I also have a clear function:

        clear: pickerId => {
            var picker =
            var users = picker.GetAllUserInfo();

            _.map(users, u => {

            console.log("Emptied picker ", pickerId);

So my problem is I don't know when to clear. I can clear using the OnValueChangedClientScript but this is called everytime you type, which is a lot. I can't do it with the OnUserResolvedClientScript since it clears the item just selected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.