Limitations with CRM FetchXML

18 June 2013
Daniel Cai

After launching our SQL2FetchXML website, we received a few inquiries about some special SQL scripts that cannot be converted to FetchXML queries using the free online utility. I here put together a list of the limitations with CRM FetchXML that I have observed. I will try to be thinking of the limitations by comparing it to what can be done through SQL script.

  1. RIGHT OUTER JOIN is not supported.
  2. You can't compare two fields directly, you can only compare a field with a static value. (This is no longer true as of July 2020 if you are on the latest Dynamics 365 online version or future on-premises releases as made available)
  3. You can't have OR condition across entities. (This is no longer true since CRM 2013 release)
  4. You can't use SQL functions in FetchXML query. CRM has support for some built-in functions, but any additional SQL functions are not supported.
  5. No support of UNIONs (Thanks to Dirk Fabricius for his contribution by commenting on this post initially). 
  6. There is no support of a CASE / WHEN structure.
  7. When you issue a FetchXML query, the maximum number of records you get back from CRM server is 5,000 each time. If you want to get more records from CRM server, you would have to use paging cookie.
  8. You can't have more than 10 linked entities in a FetchXML query. It is possible to overcome this limit by creating or updating a QueryLinkEntityLimit setting, however this is generally not recommended. If you ever run into this situation, you would definitely want to re-visit your CRM data model or re-engineer your query.
  9. When you perform an aggregation, the maximum number that will participate in the aggregation will be 50,000 records. For instance, if you do a COUNT aggregation, the maximum value you can get back from CRM is 50,000 even though that you might have more records in the system. This is a by-design behavior which is for performance reason. This can be overcome by updating "AggregateQueryRecordLimit" setting, however it is generally not recommended.
  10. There is no way to use subqueries. (This is no longer true after some recent updates in 2024, you can now use EXISTS, IN, ANY, NOTANY, ALL query conditions).
  11. There is a wacky limitation that you can't have more than 2097 conditions per filter, according to Daniel Halan

This is what I have got so far. Please let me know if I have missed anything.

Archive

October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags