title: Retrieve the fetchxml in grid via javascript
body: <p>This might seem a bit of an odd request so I'll try to offer some background. I have a feature on my CRM which requires that user should be able to filter a view and then save the resulting records such that a separate process can pick them up and process them periodically e.g. daily.</p>
  
  <p>Now here's the catch, they want this process to requery the data before it processes it, so basically what should be saved is the query or filters rather than the data in the view.</p>
  
  <p>Having previously written some javascript code which dynamically sets the fetchxml on a subgrid like so </p>
  
  <pre class="lang-js prettyprint-override"><code>Subgrid.getGrid().setParameter("fetchXml", fetchxml);
  </code></pre>
  
  <p>I though it should be fairly straight forward to potentially retrieve the fetchxml in the grid </p>
  
  <pre class="lang-js prettyprint-override"><code>Subgrid.getGrid().getParameter("fetchXml");
  </code></pre>
  
  <p>However that doesn't work and I can't seem to find any documentation or anything that can point me in the right direction. I have used Developer tools to inspect the properties of <code>Mscrm.XrmControlGridWrapper</code> but I can't find anything useful..</p>
  
  <p>If anyone knows how I can retrieve the fetchxml that powers a subgrid using javascript, it would be massively helpful?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have just found that I can do this</p>
  
  <pre class="lang-js prettyprint-override"><code>Subgrid.getGrid().getFilter().$3_1.GetParameter("fetchXml")
  </code></pre>
  
  <p>and that returns exactly what I want, however this just screams of hacky and unsupported.
  <code>$3_1</code> has a type of <code>[object (Mscrm.TurboGridControl)]</code></p>
  
  <p>Is there a way I can access this object in a supported way? </p>