Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Subgrid Lookup filter

Posted on by Microsoft Employee

Hi Guys,

I have a requirement to do a filter on lookup field on a subgrid, I found a couple of resources online, but I have a very small doubt in that code.

Here's the code I found.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//www.bobylog.com
var filterXML = [
            '<filter type="and">',
            '<condition attribute="statecode" value="0" operator="eq"/>',
            '<condition attribute="attr2" operator="eq" value="{75a9fde0-a559-4fe1-94ec-215a8d15efb9}"/>',
            '</filter>'
        ].join('\n');
        document.getElementById("sampleSubGrid").addEventListener("click", function () {
            setTimeout(function () {
                var gridControl = Xrm.Page.getControl("sampleSubGrid");
                var me = gridControl.$c_0.$N_4.$Y_3;
                me.addPreSearch(function () {
                    me.addCustomFilter(filterXML);
                });
            }, 2000);
        });

But I'm not sure which lookup this line points to "gridControl.$c_0.$N_4.$Y_3", I have multiple lookups on my grid I only want to filter one of them.

Please help me out here.

Thanks,

Vinod

*This post is locked for comments

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Subgrid Lookup filter

    Hi,

    you can refer below post for more information. But i strongly not recommended to do that, because this might not working in future update.

    CLICK HERE UNSUPPORTED USE IT AT YOUR OWN RISK

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Subgrid Lookup filter

    Vinod,

    I'm curious - what kind of help do you expect? This stuff you're asking for is available in your browser. How can anybody help you with it?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Subgrid Lookup filter

    Okay can you help me with this "gridControl.$c_0.$N_4.$Y_3"?

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Subgrid Lookup filter

    Hi,

    there is no supported way to filter the subgrid lookup.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Subgrid Lookup filter

    Please let me know if there's any other supported alternative, that would help.

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Subgrid Lookup filter

    Hi,

    this is unsupported code. Are you sure you want to do that?

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans