web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

"addCustomView" not setting the default view

(0) ShareShare
ReportReport
Posted on by 216

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".

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 102

#2
11manish Profile Picture

11manish 88 Super User 2026 Season 2

#3
ParthPatel249 Profile Picture

ParthPatel249 84

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans