Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Set lookup field to custom view with setDefaultView

Posted on by

I'm trying to set the "customerid" lookup field on the case form to a particular custom view that I've created. I am trying to use:

Xrm.Page.getControl("customerid").setDefaultView(viewGuid);

I believe I have the correct guid for the custom view I have created, but the lookup filter is not changing. The view I want to be used as the lookup is a view I created on the contact entity. Am I doing anything obviously wrong here? How might I go about accomplishing this? Thanks in advance for any help. 

*This post is locked for comments

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: Set lookup field to custom view with setDefaultView

    Hi,

     it could be that customerid lookup control will display data from the account/contact lookup views rather than from your view (since you can't configure a view for the customer lookup in the control properties). But a combination of addPreSearch/addCustomFilter might still work:

    www.powerobjects.com/.../restrict-customer-lookup-to-accounts-or-contacts-in-dynamics-crm

  • fishyjj Profile Picture
    fishyjj on at
    RE: Set lookup field to custom view with setDefaultView

    Thanks for your reply. This article addresses something slightly different than what I am trying to do. I have already created a view through configuration. When I use setDefaultView, and then open up the lookup dialogue, it works to show my view. BUT when I just search in the lookup, or just drop down the lookup, the proper filter is not applied. Do you know of any way to apply the filter that is used on the view I have already created?

  • Inogic Profile Picture
    Inogic 24,094 on at
    RE: Set lookup field to custom view with setDefaultView

    Refer below blog.

    http://www.inogic.com/blog/2014/09/add-custom-view-in-lookup-and-disable-all-the-other-views/  

    If this answered your question, please make sure to Mark this as an Answer.

    Thanks!

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans