简体   繁体   中英

Execution of Fetch XML using Web API Dynamics 365

I am using this approach for paging using Fetch XML within Web API.

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 eg:

<b><cookie pagenumber="2" pagingcookie="" istracking="False" /></b>

Here you can see we have nothing in pagingcookie.
Fetch XML used for query:

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

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

Is there any way to get the exact paging cookie in complex scenarios?

I've seen this happen before in the standard organization service. I would suggest just paging without the paging cookie - this resolved the issue for me in the organization service.

Eg <fetch mapping="logical" page="1" count="50">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM