locked
QueryExpression top 1 RRS feed

  • Question

  • Is it possible to only return the top 1 record in a QueryExpression? like you can in FetchXML, if so how :)

    Thanks

    Pete


    Pete

    Tuesday, June 24, 2014 9:14 AM

Answers

  • Hi,

    Have you tried this..

    pagequery.PageInfo.Count = fetchCount;

    http://stackoverflow.com/questions/15609196/retrieve-top-five-opportunities-from-crm-using-c-sharp

    http://msdn.microsoft.com/en-us/library/gg327917.aspx


    • Edited by Suresh Sorde Tuesday, June 24, 2014 9:33 AM
    • Proposed as answer by Laughing John Tuesday, July 1, 2014 5:51 PM
    • Marked as answer by Pete.CRM Tuesday, July 1, 2014 6:18 PM
    Tuesday, June 24, 2014 9:33 AM

All replies

  • Hi,

    Have you tried this..

    pagequery.PageInfo.Count = fetchCount;

    http://stackoverflow.com/questions/15609196/retrieve-top-five-opportunities-from-crm-using-c-sharp

    http://msdn.microsoft.com/en-us/library/gg327917.aspx


    • Edited by Suresh Sorde Tuesday, June 24, 2014 9:33 AM
    • Proposed as answer by Laughing John Tuesday, July 1, 2014 5:51 PM
    • Marked as answer by Pete.CRM Tuesday, July 1, 2014 6:18 PM
    Tuesday, June 24, 2014 9:33 AM
  • As Suresh points out, you just need to set PageInfo.Count equal to 1.
    Tuesday, July 1, 2014 5:53 PM