Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Opening lookup view dynamically

Posted on by 20

Hi All,

I have one requirement like if I ckick on + button which is HTMl, need to open lookup view.

I did this by using Xrm.Utility.lookupObjects(lookupOptions).

But in my requirement if I change the view by clicking view selector, filter is applying on filter of default binding view.

I need to change the filter if I select another view also.

Please get me if you have any possibilities.

Thanks in advance.

  • CRM Issues Profile Picture
    CRM Issues 20 on at
    RE: Opening lookup view dynamically

    hi @rthompson

    By above code by default contact look up view is opening. If I change another view, view filter is applying on this filter(which is passed by lookupoptions). I dont want like this.

    Thanks

  • CRM Issues Profile Picture
    CRM Issues 20 on at
    RE: Opening lookup view dynamically

    var Department = parent.Xrm.Page.getControl("com_department").getAttribute().getValue()[0].id;

    var lookupOptions = {};

    lookupOptions.allowMultiSelect = false;

    lookupOptions.defaultEntityType = "contact";

    lookupOptions.entityTypes = ["contact"];

       lookupOptions.filters = [{

           filterXml: "<filter type='and'><condition attribute='com_primarydepartmentid' operator='eq' uitype='account' value='" + Department + "' /></filter>",

           entityLogicalName: "contact"

       }];

    Xrm.Utility.lookupObjects(lookupOptions).then(

    function (result) {

    if (result != undefined && result.length > 0) {

    contactlookup = new Object();

    if (result.length > 0) {

    for (var i = 0; i < result.length; i++) {

    entityreferencecontact = result[0].name;

    contactlookup.LogicalName = result[0].entityType;

    contactlookup.Id = result[0].id;

    }

    }

    }

    },

    function (error) { }

    );

  • rthompson Profile Picture
    rthompson 1,530 on at
    RE: Opening lookup view dynamically

    Hi,

    Are you filtering using javascript.

    Could you please show what you are doing.

  • CRM Issues Profile Picture
    CRM Issues 20 on at
    RE: Opening lookup view dynamically

    Hi,

    If I apply any filter,is applying for all views on that views actual filters are applying.

    I want to apply filter for only one view.

    Thanks!

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Opening lookup view dynamically

    I don't think this is possible (at least not in a supported way). I think the best you can do is disable the view selector, but instead give the user the option of which view they want (maybe by having different buttons for each view) before opening the lookup view

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans