I'm trying to dynamically add a dynamically filtered view to a lookup. My code, in general, works - when the user clicks the lookup icon only filtered elements are displayed, so I know my filter works. However, I can't get the system to display this filtered view by default after the user clicks the "find more records" button. The custom view is certainly available in the view selector in the lookup window, but isn't selected by default.
I've tried using setDefaultView as well, with no results.
What I also found surprising is that getDefaultView returns... an empty string, for some reason.
Essentially this is my code:
subgridLookup.addPreSearch(() => { subgridLookup.addCustomView(this.emptyGuid, "neu_payer", r[0].name, fetchXml, r[0].layoutxml, true); subgridLookup.setDefaultView(this.emptyGuid); });
The code fragment is in TypeScript, which is why it might seem a little bit odd. Suffice to say that 'r[0' is a view definition retrieved by hand ("savedquery" entity) and I'm using the fetchXml from it to construct a more filtered fetchXml as well as the layoutXml parameter. I've tried using the view ID in both the addCustomView and setDefaultView methods, but that didn't help. As you can see the final parameter (isDefaultView) is set to true.
What do I need to do to set the default view on the "find more records" screen?
PS. I've tried this with and without "addPreSearch".