Lookup field - Logic to ensure already selected values are filtered out

Hi

I have a list where a field is configured as a lookup column(unique values). I need to ensure that when the list form (New/Edit) loads the field only shows values that haven't already been assigned in the list. Is this doable?

Thanks in advance.

Hi @SamirPateluk,

I don't think there's an easy way to achieve this. Try getting the already selected values from the list with PnP, then creating a custom filter for the lookup based on them.

Creating a validator should be a much simpler alternative.

1 Like

Hello @SamirPateluk ,
I would also use dropdown custom field (in Plumsail Designer) and dynamically fill in values based on values that had already been added to the list.
So when I have three choices - YES, NO, DO NOT KNOW

When the form is loading (new) I would call PnP JS to return all the records in the list and filter out selected and only fill in choices that are available (so two records will contain YES and NO) So you will load only "I DO NOT KNOW". :slight_smile:

So it is doable, I would not prefer vLookup, but use Javascript and Dropdown field.

Stepan

1 Like

Thank you for the note. I had been looking at liaLazarevskii's steer and I started thinking about your suggestion too, however I also need to ensure the Edit form has the same functionality.

Hello @SamirPateluk, of course, do the same function for the EditForm.
Use it on NewForm and also EditForm. I think the code should be the same :slight_smile:
Stepan