locked
CRM 2011 - Simple FetchXML query using service.RetrieveMultiple(...) PagingToken is always null? RRS feed

  • Question

  • Hi,

    I have a simple fetchxml query retrieving accounts.  I specify the count and page to ensure I get fewer than the total number of records but the PagingToken in the EntityCollection returned from the service.Execute(RetrieveMultipleRequest) does not have a paging token even though the total number of records is correct (e.g. 100).  

    Am I missing something?

    <fetch version="1.0" output-format="xml-platform" distinct="true" no-lock="true" count="2" page="1" returntotalrecordcount="true" mapping="logical">
      <entity name="account">
        <attribute name="accountnumber" />
        <attribute name="name" />
        <filter type="and">
          <condition attribute="name" operator="like" value="%" />
        </filter>
        <order attribute="name" descending="false" />
      </entity>
    </fetch>


    Andy

    Thursday, December 20, 2012 7:40 PM

Answers

  • So it turns out if distinct="true" or any linked entities are added, the paging cookie functionality is DISABLED and you get back NULL all the time even when there are records remaining to be retrieved.

    Note: Luckily, using FETCHXML you can sort on all of your linked entities so you can implement your own paging via filters 

    TOO BAD QueryExpression does NOT support sorting on linked entities so you HAVE TO use FetchXML :-(


    Andy

    Thursday, December 20, 2012 8:10 PM