I have a javascript function that adds a custom view to a control using fetchXML. My issue is that the count attribute on the root <fetch> node is not working. I have it set to 6, but it's returning 26 records (all of the records), defined by the fetch.

Here is the fetchXML

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' count='6'>
  <entity name='xyz_entity'>
    <attribute name='xyz_entityname' />
    <attribute name='xyz_startdate' />
    <attribute name='xyz_enddate' />
    <attribute name='xyz_currententity' />
    <attribute name='xyz_inactiveentity' />
    <order attribute='xyz_currententity' descending='true' />
    <order attribute='xyz_startdate' />
    <filter type='or'>
      <condition attribute='xyz_currententity' operator='eq' value='1' />
      <filter type='and'>
        <condition attribute='xyz_startdate' operator='ge' value='2011-11-01' />
        <condition attribute='xyz_enddate' operator='gt' value='2011-11-01' />
      </filter>
    </filter>
  </entity>
</fetch>

And the fetchXML is being used in the javscript like this:

Xrm.Page.getControl("itt_termid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);

but when the user clicks on the lookup icon, all 26, rather than 6 records get returned.

有帮助吗?

解决方案

Users can specify how many records they want to appear per page, and since the control has to do paging of its own, my guess would be that it's replacing your count with its own. If you run this fetch outside of the context of a lookup view, does it correctly limit the count?

其他提示

Have you tried explicitly specifying the page number (as 1) ?

Something like

<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'     page='1' count='6'>

This appears to be a bug in the Custom Views for CRM 2011. It also doesn't support order by as referenced by this page: http://social.microsoft.com/Forums/en/crmdevelopment/thread/81537133-b3a7-457b-a257-b745b30ca98e

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top