Control Lookup Filter Issue

I am having a strange issue with a Lookup control type, I am trying to filter the items in the lookup field on form render but it does not show me the filtered results until a select an item and then clear the item as shown in the following video:

I use the following code to filter the lookup:

    fd.control('fdSpecDivionFilter').ready(function(control){
        control.filter = "ProjectId eq '" + fd.itemId + "'";
        control.useCustomFilterOnly = true;
        control.refresh();
        control.$on('change', function(value){
            filterSpecs(value);
        });
    });

Hello @cwalter2,

Are you getting any errors in the browser console? Please share the screenshot.

What does the filterSpecs() function do? Please share the code.

It filters a document library control. Here is that functions codes:

    function filterSpecs(a){
        var filter = "<Eq><FieldRef Name='Project' LookupId='TRUE' /><Value Type='Lookup'>" + fd.itemId + "</Value></Eq>"
        if(a){
            filter = "<And>" + filter;
            filter += "<Eq><FieldRef Name='DivisionNumber' LookupId='TRUE' /><Value Type='Lookup'>" + a.LookupId + "</Value></Eq></And>"
        
        }
        fd.control('Specifications').filter = filter;
        fd.control('Specifications').refresh();
    }

The only error I get is this, I think this error comes up on most of my forms:
image

Dear @cwalter2,
Try just the default filter query, see what results it gives:

fd.spRendered(function() {
    fd.control('fdSpecDivionFilter').ready(function(control) {
        control.filter = "ProjectId eq '" + fd.itemId + "'";
        control.refresh();
    });
});

I changed the query as suggested, cleared the cache and browser history and have the same result.

Dear @cwalter2,
Make sure you have the latest version of the app package, otherwise scripts might not work correctly - Installation of Plumsail Forms for SP Online (Microsoft 365) — SharePoint forms

Pretty sure I am current:
image

FYI, I have also removed the control from the sheet and re-created it to see if that would make a difference. It did not.

Hello @cwalter2,

Could you please export the form and share it with me?

You can share it here or send it to support@plumsail.com