Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Unable to Add Custom View in Lookup

(0) ShareShare
ReportReport
Posted on by 290

Hi All,

I am trying to set Contact Entity and its custom view in attendirequired attribute of Appointment entity with the help of below link but unable to set.

Issue: By default in "attendirequired " lookup window shows "Account" entity and instead of this i want to set "Contact" entity bydefalut.

After follow same coding part still its showing Account entity by-default not contact entity.

Kindly help me is that possible or not. if yes then please help me what i am missing here.

https://community.dynamics.com/crm/b/crminogic/archive/2014/09/15/add-custom-view-in-lookup-and-disable-all-the-other-views

*This post is locked for comments

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Unable to Add Custom View in Lookup

    Hi Mohammed Sharique,

    Try the code below.

    // Change the entity from Account to Contact.
    var control = Xrm.Page.getControl("lookupfieldname");
    control.getAttribute().setLookupTypes(["contact"]);
    
    // Add the custom view for the lookup field
    Xrm.Page.getControl("contact").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

    Hope this helps.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans