locked
Add fetchXml filter to a subgrid in CRM 2013 RRS feed

  • Question

  • Hi all,

    I'm trying to add a filter fetchXml in a subgrid view in CRM 2013 as I did in the 2011 version but when I'm trying to get the control of the subgrid it returns me a null value.

    I'm trying the following commands:

    -Xrm.Page.getControl('accountactivities_d')

    -Xrm.Page.getControl('accountactivities')

    -document.getElementById('accountactivities_d').control.SetParameter(“fetchXml”, fetchXml);

    -document.getElementById('accountactivities_d').SetParameter(“fetchXml”, fetchXml);

    -document.getElementById('accountactivities_d').control.Refresh();

    Does anybody know how can I do to take the control, and then add the filter and refresh the grid?

    Many thanks to all!


    • Edited by Jav Gon Wednesday, February 12, 2014 1:06 PM
    Wednesday, February 12, 2014 12:48 PM

All replies

  • Hi,

    Please check if your object is null in case wait for some time and check it again, it seems it is not loaded yet.


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Wednesday, February 12, 2014 1:06 PM
    Moderator
  • Hi,

    Have you tried like this :

    http://social.microsoft.com/Forums/en-US/4d19ff91-b392-46bb-ae95-578ba4e70142/crm-2013-subgrid-fetch?forum=crmdevelopment


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    Wednesday, February 12, 2014 1:06 PM
  • Hi,

    First of all thanks for the answers

    I have a load control at the beggining of the code that allows to continue executing the function if document.getElementById('accountactivities_d').readyState == "complete". And as much time as I wait, the getControl or the SetParameter allways return null. Moreover, it only appear the fields of the form if I look the elements which I can take control (doing Xrm.Page.getControl()). There aren't any subgrids.

    Also, I did the steps that the link that you have sent me without succeed.

    Wednesday, February 12, 2014 1:23 PM
  • Hi,

    At least I could add the SetParameter, but I have another question:

    Does anybody know how can I add a filter to an activity subgrid of an account to show all the activities from the account's child entities (opportunities, incidents, contacts...)?

    Many thanks!

    Thursday, February 13, 2014 6:19 PM