Filter Subgrid based on another subgrid selection using plugin.


   Two related subgrids on one Form with a parent-child-grandchild relationship 

    I have following requirement.

     Let's assume there 3 entities

     A , B, C
             Relationships are as follows:
             A:B ==> 1:N

             B:C ==> 1:N

              C is grandchild of A. 

Now, In a Form for entity A which displays two subgrids (one for entity B and the other for entity C).

Here,  Subgrid C should only display grandchild records of the selected child record in subgrid B. When I change the selected record in subgrid B then subgrid C should refresh.

The above requirement, I need to do using Plugin. (Dynamics 365 CRM)Please help me.