web
You’re offline. This is a read only version of the page.
close
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".

I have the same question (0)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans