Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to filter Associated view in ms crm 2013-2015

Posted on by Microsoft Employee

I have two sub-grids & I filtering it without any issue. But these sub-grids has open associated view icon:

68285.1.png

So, on click of it opens the associated views but it's showing all unwanted records which I want to filter them out again. And my own fetchxml which I added for sub-grid. Can you tell me how can I access the Associated Grid View control so, that I can set the fetchxml on it?

I tried to customize the "Open Associated Grid View" command but still getting nothing relevant. 

843067.2.png

Any idea how it can be done?

EDIT:

We can access the sub-grid by - var SubGrid = document.getElementById("Activity_SubGrid");

and then set the fetchxml to it. But do we have any option to access the Associated views?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to filter Associated view in ms crm 2013-2015

    I guess you can refer this, I explained it here

    xcrmblog.wordpress.com/.../how-to-filter-associated-grid-view-ms-crm

  • PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: How to filter Associated view in ms crm 2013-2015

    yups, do let me know once you finalize a approach for this. It will be interesting to know.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to filter Associated view in ms crm 2013-2015

    Yeah!! I tried this it will set the datefilter here we cannot set my fetchxml query. And it will work only when user goes to the associated view after clicking related navigation links. I guess it is not working when I am going to associated view from associated view icon, even though it can be handled but above code is not working.

    I guess I need to inject the fetchxml the way we do for Sub-grid then only it has to work.

    but thanks a lot for the help.

  • Suggested answer
    PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: How to filter Associated view in ms crm 2013-2015

    Perhaps something like this will help: Although this is unsupported:

    function filterAllActivities() {

       document.getElementById("navActivities").onclick = function () {

           Mscrm.Details.loadArea(this, "areaActivities");

           document.getElementById("areaActivitiesFrame").onload = function () {

               var entityName = Xrm.Page.data.entity.getEntityName();

               var entity = entityName.charAt(0).toUpperCase() + entityName.substr(1);

               var doc = this.contentWindow.document;

               var filterOn = doc.getElementById("crmGrid_" + entity + "_ActivityPointers_datefilter");

               filterOn.value = "All";

               var evt = document.createEvent("HTMLEvents");

               evt.initEvent("change", false, true);

               filterOn.dispatchEvent(evt);

           };

       };

    }

    You may need to change the code a bit to achieve your desired result. This is something I found on open internet.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to filter Associated view in ms crm 2013-2015

    I want to add my own fetchxml query, and it should work only for one entity.

    I will make it more clear. Say I have activity sub-grid & associated view. And based on the diff business logic I am filtering the records & showing it to Activity sub-grid. But I need to show same data in Associated view of Activities. I want to know is there a way to get the control of the activity associated view? Unsupported.

  • Suggested answer
    PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: How to filter Associated view in ms crm 2013-2015

    Hi you can try this

    Goto --> "customize the system" in your contact entity > view --> Find the associated view --> Edit the default filters.

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