【发布时间】:2017-05-06 21:02:25
【问题描述】:
我正在使用this 方法在 Web API 中使用 Fetch XML 进行分页。
Web API 在我们使用简单 fetch 时完美运行,如果有更多记录,它会返回分页 cookie 以及结果,但是当我们使用复杂(我们有链接实体)Fetch XML 时,它会返回分页 cookie 但为空,例如:
<b><cookie pagenumber="2" pagingcookie="" istracking="False" /></b>
在这里您可以看到我们在 pagingcookie 中没有任何内容。
获取用于查询的 XML:
<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>
如果我们删除链接实体,它会开始在响应中提供准确的分页 cookie,可以使用@Microsoft.Dynamics.CRM.fetchxmlpagingcookie 获取。
有什么方法可以在复杂场景中获取准确的分页 cookie?
【问题讨论】:
标签: api web dynamics-crm microsoft-dynamics fetchxml