Lookup Field Filter not applying

I know the Depends on function is the Form replaces some of the need for using Javascript to set a filter, but, I have a use case where I still want to set the filter with Javascript.

My issue is, I am setting the filter value, but the filter is not applying:

fd.control('Contact').filter = 'Organization/Id eq ' + organizationId;

I have tried with and without

fd.control('Contact').widget.dataSource.read();

If I write out the filter value to the console, it has my filter value, but the field is just not filtering.

Am I missing something?

Hello @sphilson.

Please try out this code:

fd.spRendered(function() {
    fd.control('Contact').ready().then(function() {
        fd.control('Contact').filter = 'Organization/Id eq ' + organizationId;
        fd.control('Contact').refresh();
    });
});

The .refresh() is what I was missing!! Thank you!

1 Like