Skip to main content

Notifications

Announcements

No record found.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

#3
Sahra Profile Picture

Sahra 43

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans