Execution of Fetch XML using Web API Dynamics 365
<p>I am using <a href="https://msdn.microsoft.com/en-us/library/mt607533.aspx" rel="nofollow noreferrer">this</a> approach for paging using Fetch XML within Web API. </p>

<p>Web API works perfect when we use simple fetch and it returns pagging cookie along with results if there are more records but when we use complex(where we have link entities) Fetch XML it returns paging cookie but empty e.g.:</p>

<p><code>&lt;b&gt;&lt;cookie pagenumber="2" pagingcookie="" istracking="False" /&gt;&lt;/b&gt;</code> </p>

<p>Here you can see we have nothing in pagingcookie.<br>
<strong>Fetch XML used for query:</strong></p>

<pre><code>  &lt;fetch mapping="logical" version="1.0" output-format="xml-platform" count="10" page="1" &gt;
  &lt;entity name="invoicedetail" &gt;
  &lt;attribute name="invoicedetailid" /&gt;
  &lt;attribute name="uomid" /&gt;
  &lt;attribute name="quantity" /&gt;
  &lt;attribute name="manualdiscountamount" /&gt; 
  &lt;attribute name="priceperunit" /&gt;
  &lt;attribute name="extendedamount" /&gt;
  &lt;filter&gt;
  &lt;condition  entityname="invoice" attribute="customerid" operator="eq"    value="{5A8F8B46-2443-E511-80E3-3863BB351E10}" /&gt;
  &lt;/filter&gt;
  &lt;link-entity name="invoice" from="invoiceid" to="invoiceid" &gt;
  &lt;attribute name="invoiceid" /&gt;
  &lt;attribute name="invoicenumber" /&gt;
  &lt;attribute name="description" /&gt;
  &lt;attribute name="totalamount" /&gt;
  &lt;order attribute="ss_postingdate" descending="true" /&gt;
  &lt;/link-entity&gt;
  &lt;/entity&gt;
  &lt;/fetch&gt;
</code></pre>

<p>If we remove linked entity it starts giving the exact paging cookie in the response that can be get using <code>@Microsoft.Dynamics.CRM.fetchxmlpagingcookie</code>. </p>

<p>Is there any way to get the exact paging cookie in complex scenarios? </p>