Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

D365 client customization's setLookupTypes(["contact"]) doesn't support Connection entity's Connected To field type?

Posted on by 7,392 User Group Leader

Hi,

I want to restrict the number of entities shown in the

Here's my piece of code -

oConnectionFormCustomization = {
    filterRequiredLookups: function (context) {
        "use strict";
        debugger;
        var con = context.getFormContext();
        //Xrm.Page.getControl("record2id").addPreSearch(oConnectionFormCustomization.addFilter);
        con.getControl("record2id").setEntityTypes(["account", "contact", "systemuser"]);
    }

 
};

I'm calling this method on Load of the Connection form and passing the execution context too as per the v9 standards.

But, when I try this on the Console of DevTools to see where the code is breaking,  I get this -

setEntityTypes-issue.png

Any thoughts on what I could be doing wrong?

Thanks.

*This post is locked for comments

  • Suggested answer
    Priyesh Profile Picture
    Priyesh 7,392 User Group Leader on at
    RE: D365 client customization's setLookupTypes(["contact"]) doesn't support Connection entity's Connected To field type?

    Hi,

    Thanks for your answer. However, this doesn't seem to work. I'm not sure if Microsoft supports this. I see this error -

    On the line, I get this error

    notImplementedException.png

    And when I try to debug, I see this exception thrown

    notImplementedException.png

    It looks like this is not supported by Microsoft?

    Any thoughts on this?

    // JavaScript source code
    oConnectionFormCustomization = {
        filterRequiredLookups: function (context) {
            "use strict";
            debugger;
            var con = context.getFormContext();
            var con = context.getFormContext();

            var value = con.getAttribute("record2id").getValue();

            con.getAttribute("record2id").setValue([]);

            con.getControl("record2id").setEntityTypes(["account", "contact", "systemuser"]);

            con.getAttribute("record2id").setValue(value);
        },

       addFilter: function () {
           Xrm.Page.getControl("record2id").getAttribute("record2id").setLookupTypes(["lead", "contact"]);
        }

    };

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    Kalpavruksh D365 CoE 2,545 on at
    RE: D365 client customization's setLookupTypes(["contact"]) doesn't support Connection entity's Connected To field type?

    Hey Priyesh,

    Can you please try this workaround:

    filterRequiredLookups: function (context) {

      "use strict";

       debugger;

        var con = context.getFormContext();

    var value = con.getAttribute("record2id").getValue();

    con.getAttribute("record2id").setValue([]);

    con.getControl("record2id").setEntityTypes(["account", "contact", "systemuser"]);

    con.getAttribute("record2id").setValue(value);

        }

    Please let us know if it works. If found useful, please mark this answer as a verified answer.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans