My environment: SharePoint 2019 On Premise + Plumsail Forms Modern Design
I have list "Org Units". I've create lookup field in library "Documentation".
I want to filter lookup drop down menu, by the "Valid From" and "Valid To" field.
I want to see items if:
- Valid To is blank and (Valid From is blank or Valid From is older than Today)
- Valid To is newer than Today
I'm sorry, I'm new to Plumsail - I don't know how and where to construct the filter query.
Dear @Matus_Corny,
This does not look like a Plumsail Form, they are built in Modern UI. Are you using Forms Designer or Plumsail Forms for SharePoint?
Hello
thank you for response. I'm using "Plumsail Forms".
Dear @Matus_Corny,
This doesn't look like a Plumsail Form, it should look like this:
Can you send me a screenshot from the editor you've used to customize the form?
Oh, I see...
Because production environment is in Slovak language, I've created those 2 list/library just for demonstration. And in wrong environment. Sorry...
This is also just for demonstration, but in the same environment, in subsite with EN language. The question is still the same: how to filter drop down by Date Fields?
I'm using this developer tool:
Dear @Matus_Corny,
We have an article here for the filtration, but it's not about date - Configure cascading lookup fields on a SharePoint form with JavaScript — SharePoint forms
What conditions do you want date field to match? Should it match some field, should it be within a month, or something else?
Also, I recommend checking out this article about Grids and layout of the forms, currently your fields are limited to half the form, so they don't look good in a panel - Grids in Plumsail Forms for SharePoint — SharePoint forms
As I wrote at the beginning I want to see items in drop down if:
- Valid To is blank and (Valid From is blank or Valid From is older than Today)
- Valid To is newer than Today
Dear @Matus_Corny,
Working with date fields is always tricky. Here's how OData filters work for date fields - OData: Date "Greater Than" filter - Stack Overflow
So, you'll need to try something like this:
fd.field('Lookup').filter = "ValidTo gt '" + new Date().toISOString() + "' or ValidTo eq null";
fd.field('Lookup').refresh();
This is a very basic example, there could be more complications working with dates, as thet depend on a lot of factors (even what Time zone is valid for the current user).