Why Custom Filter JS code doesn’t work on Lookup field? [Fixed]
One of the major pet-peeve is not understanding why the code isn’t working. And you for sure know you’ve written the correct code. But, thing just don’t work.
One such tricky situation is that of applying custom filter to fields using JavaScript in Dynamics 365 Customer Engagement apps.
Scenario
Let’s say you have a custom filter to be applied to a field and you’ve written your JS code on Load to apply the filter and everything (you know what you need to do!)
Example:
But the above is just not working. Why???
Reason
The reason is pretty simple! Because, the Lookup field is still using the one set on the field itself. Check that –

The above should be turned off to make your code work since the field’s default OOB filtering takes precedence.
And now, your code should work (Provided everything in it correct)

Hope this quick tip helps!