Sorting SharePoint Documents by Date in Dynamics 365 CRM — Why It Fails and How to Fix It

If you’ve tried sorting SharePoint documents by Created On or Modified Date directly from the standard document grid in Dynamics 365 CRM, you’ve likely encountered an unexpected throttle error. This limitation, while frustrating, is quite common—especially in environments dealing with high document volumes. This article outlines why this issue occurs and offers practical workarounds and architectural improvements to enhance document handling inside Dynamics 365. Understanding the Issue The out-of-the-box SharePoint integration in Dynamics CRM fetches and displays documents using SharePoint’s REST APIs. When users sort by a column like "Modified", Dynamics attempts to request all related documents and sort them server-side. If the associated SharePoint document library contains a large number of files or is under heavy load, SharePoint enforces throttling policies to safeguard performance. This results in the "throttle error" users commonly see, often without much context. Recommended Workarounds and Alternatives 1. Open the Library Directly in SharePoint Users can click "Open Location" to access the SharePoint library directly. Once in SharePoint, they benefit from optimized sorting, filtering, and metadata-driven views that are far more responsive. This is the most immediate and user-friendly workaround for document-heavy environments. 2. Implement a Custom PCF Control Replacing the default document grid with a PowerApps Component Framework (PCF) control allows you to: Query SharePoint using a custom API or Power Automate Sort/filter data server-side with better performance control Display results within CRM in a clean, structured format This approach gives complete control over how documents are presented and avoids default throttling limits. 3. Organize Documents Using Folders Minimizing the number of documents per folder (e.g., one folder per record, year, or document type) significantly reduces the data load when fetching and sorting documents. This is a scalable approach, particularly in document-intensive implementations. 4. Enable Indexed Columns in SharePoint From the SharePoint document library settings, enable column indexing for commonly used fields such as Created and Modified. This improves performance when sorting or filtering directly in SharePoint and can partially help with the Dynamics 365 view as well. 5. Use Power Automate to Control the Data Load Consider using a Power Automate flow to: Retrieve and sort documents using SharePoint’s "Get files" action Limit the number of results returned Surface the data via a custom connector or embedded web resource in CRM This allows sorting logic to be controlled externally while providing a responsive experience for the user. Key Takeaway The default document grid in Dynamics 365 CRM is suitable for basic use cases, but it struggles when interacting with large or complex SharePoint libraries—particularly when sorting is required. For teams heavily reliant on document management within CRM, implementing a tailored solution (custom PCF, document library design improvements, or Power Automate-based handling) can significantly improve usability and performance. I’ll be following up with another post covering the architecture and build of a PCF-based document viewer that integrates with Power Automate for scalable document access inside CRM. Feel free to share your thoughts or alternative approaches you’ve implemented. — Nikhil Sarpatwari Connect on LinkedIn

Apr 20, 2025 - 04:15
 0
Sorting SharePoint Documents by Date in Dynamics 365 CRM — Why It Fails and How to Fix It

If you’ve tried sorting SharePoint documents by Created On or Modified Date directly from the standard document grid in Dynamics 365 CRM, you’ve likely encountered an unexpected throttle error. This limitation, while frustrating, is quite common—especially in environments dealing with high document volumes.

This article outlines why this issue occurs and offers practical workarounds and architectural improvements to enhance document handling inside Dynamics 365.

document grid

Understanding the Issue

The out-of-the-box SharePoint integration in Dynamics CRM fetches and displays documents using SharePoint’s REST APIs. When users sort by a column like "Modified", Dynamics attempts to request all related documents and sort them server-side.

If the associated SharePoint document library contains a large number of files or is under heavy load, SharePoint enforces throttling policies to safeguard performance. This results in the "throttle error" users commonly see, often without much context.

SharePointdocumentgrid

Recommended Workarounds and Alternatives

1. Open the Library Directly in SharePoint

Users can click "Open Location" to access the SharePoint library directly. Once in SharePoint, they benefit from optimized sorting, filtering, and metadata-driven views that are far more responsive.

This is the most immediate and user-friendly workaround for document-heavy environments.

2. Implement a Custom PCF Control

Replacing the default document grid with a PowerApps Component Framework (PCF) control allows you to:

  • Query SharePoint using a custom API or Power Automate
  • Sort/filter data server-side with better performance control
  • Display results within CRM in a clean, structured format

This approach gives complete control over how documents are presented and avoids default throttling limits.

PCF Control

3. Organize Documents Using Folders

Minimizing the number of documents per folder (e.g., one folder per record, year, or document type) significantly reduces the data load when fetching and sorting documents. This is a scalable approach, particularly in document-intensive implementations.

4. Enable Indexed Columns in SharePoint

From the SharePoint document library settings, enable column indexing for commonly used fields such as Created and Modified. This improves performance when sorting or filtering directly in SharePoint and can partially help with the Dynamics 365 view as well.

5. Use Power Automate to Control the Data Load

Consider using a Power Automate flow to:

  • Retrieve and sort documents using SharePoint’s "Get files" action
  • Limit the number of results returned
  • Surface the data via a custom connector or embedded web resource in CRM

This allows sorting logic to be controlled externally while providing a responsive experience for the user.

Key Takeaway

The default document grid in Dynamics 365 CRM is suitable for basic use cases, but it struggles when interacting with large or complex SharePoint libraries—particularly when sorting is required.

For teams heavily reliant on document management within CRM, implementing a tailored solution (custom PCF, document library design improvements, or Power Automate-based handling) can significantly improve usability and performance.

I’ll be following up with another post covering the architecture and build of a PCF-based document viewer that integrates with Power Automate for scalable document access inside CRM.

Feel free to share your thoughts or alternative approaches you’ve implemented.

Nikhil Sarpatwari

Connect on LinkedIn