2

how can i query to CRM Dynamics for top 50 records like top in sqlserver.

thanks,

Saboor Awan
  • 1,567
  • 4
  • 24
  • 37

3 Answers3

5

You want paging: Is it possible to limit the amount of results returned in a response when using a QueryExpression in CRM 4

Community
  • 1
  • 1
Matt
  • 4,656
  • 1
  • 22
  • 32
1

You need the QueryExpression property TopCount :

var query = new QueryExpression(entity) {
     ColumnSet = new ColumnSet(someColumns),
     Criteria = {
         Conditions = ...
     },
     TopCount = 50
 };
Elikill58
  • 4,050
  • 24
  • 23
  • 45
hdoghmen
  • 3,175
  • 4
  • 29
  • 33
0

You can use fetch xml something like below:

<fetch top="50" >
  <entity name="contact" >
    <attribute name="contactid" />
    <attribute name="fullname" />
  </entity>
</fetch>